19 #ifndef TORC_PHYSICAL_CONFIGMAP_HPP
20 #define TORC_PHYSICAL_CONFIGMAP_HPP
39 class ConfigMap :
private std::multimap<std::string, Config> {
45 typedef std::multimap<std::string, Config>
super;
72 return result != end();
95 bool getConfig(
const string& inSetting,
string& outName,
string& outValue) {
97 iterator result = find(inSetting);
105 Config& config = result->second;
130 void setConfig(
const string& inSetting,
const string& inName,
const string& inValue) {
134 std::pair<iterator, iterator> range = equal_range(inSetting);
135 if(range.first != range.second) erase(range.first, range.second);
148 iterator result = super::find(inSetting);
149 if(result == e)
return false;
160 if(inConfigMap.empty())
return;
166 const string& setting = p->first;
167 const Config& config = p->second;
178 return inSetting.size() >= 1 && inSetting[0] ==
'_';
184 {
return equal_range(inSetting); }
192 #endif // TORC_PHYSICAL_CONFIGMAP_HPP
boost::uint64_t SequenceIndex
Typedef for generic sequences.
void clearConfig(void)
Clears the configuration map.
void setConfig(const string &inSetting, const Config &inConfig)
Sets the configuration for the given setting.
void setConfig(const string &inSetting, const string &inName, const string &inValue)
Sets the configuration for the given setting.
bool getConfig(const string &inSetting, Config &outConfig)
Looks up the specified setting in the map.
Header for the Config class.
size_t getConfigCount(void) const
Returns the number of configurations in the map.
string mName
The name of the object.
static bool allowConfigDuplicates(const string &inSetting)
Returns true if multiple configurations are allowed for the given setting.
void addConfigs(const ConfigMap &inConfigMap)
Merges the configurations from the given ConfigMap into this one.
std::string string
Imported type name.
const_iterator const_iterator
Constant iterator to {setting,Config} pairs.
bool getConfig(const string &inSetting, string &outName, string &outValue)
Looks up the specified setting in the map.
bool removeConfig(const string &inSetting)
Removes the named configuration.
const_iterator configBegin(void) const
Returns the begin constant iterator for configurations.
size_type getMultiConfigCount(const string &inSetting)
Returns the number of configurations for the given setting.
string mValue
The configuration setting value.
Configuration. A {name:value} pair.
bool hasConfig(const string &inSetting) const
Returns true if the specified setting exists in the map.
const string & getName(void) const
Returns the object name.
const string & getValue(void) const
Return the configuration value.
static const char * sConfigDefaultValue
Default configuration value.
std::multimap< std::string, Config > super
Convenience typedef to represent our superclass.
ConfigMap(void)
Null constructor.
SequenceIndex mNextSequenceIndex
Sequence index to use for the next configuration added to this map.
Configuration setting map.
bool configIsEmpty(void) const
Returns true if the configuration map is empty.
std::pair< iterator, iterator > getMultiConfigValues(const string &inSetting)
Returns a range that encompasses all of the configurations for the given setting. ...
const_iterator configEnd(void) const
Returns the end constant iterator for configurations.
static const char * sConfigDefaultName
Default configuration name.