156 typedef std::map<std::string, std::vector<MetaValue> > map_t;
171 void set(
const char *name, T value) {
173 map_[std::string(name)] = std::vector<MetaValue>(1, value);
178 void append(
const char *name, T value) {
179 map_t::iterator it = map_.find(std::string(name));
180 if (it == map_.end()) {
184 it->second.push_back(v);
188 void remove(
const char *name) {
189 map_t::iterator it = map_.find(std::string(name));
190 if (it != map_.end()) {
197 map_t::const_iterator it = map_.find(std::string(name));
198 if (it != map_.end()) {
199 return it->second.size();
205 long as_long(
const char *name,
size_t index = 0)
const {
206 return value(name, index).as_long();
210 double as_double(
const char *name,
size_t index = 0)
const {
211 return value(name, index).as_double();
215 const char *as_str(
const char *name,
size_t index = 0)
const {
216 return value(name, index).as_str();
219 const MetaValue &value(
const char *name,
size_t index = 0)
const {
220 map_t::const_iterator it = map_.find(std::string(name));
221 if (it == map_.end()) {
222 throw std::runtime_error(
"Attempting to access unknown parameter");
224 if (index >= it->second.size()) {
225 throw std::runtime_error(
"Attempting to access indexed value out of bounds");
227 return it->second[index];
234 map_t::iterator begin() {
238 map_t::iterator end() {
242 map_t::const_iterator begin()
const {
246 map_t::const_iterator end()
const {