torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::physical::ConfigMap Class Reference

Configuration setting map. More...

#include <ConfigMap.hpp>

+ Inheritance diagram for torc::physical::ConfigMap:
+ Collaboration diagram for torc::physical::ConfigMap:

Public Types

typedef const_iterator const_iterator
 Constant iterator to {setting,Config} pairs. More...
 

Public Member Functions

 ConfigMap (void)
 Null constructor. More...
 
const_iterator configBegin (void) const
 Returns the begin constant iterator for configurations. More...
 
const_iterator configEnd (void) const
 Returns the end constant iterator for configurations. More...
 
size_t getConfigCount (void) const
 Returns the number of configurations in the map. More...
 
bool configIsEmpty (void) const
 Returns true if the configuration map is empty. More...
 
void clearConfig (void)
 Clears the configuration map. More...
 
bool hasConfig (const string &inSetting) const
 Returns true if the specified setting exists in the map. More...
 
bool getConfig (const string &inSetting, Config &outConfig)
 Looks up the specified setting in the map. More...
 
bool getConfig (const string &inSetting, string &outName, string &outValue)
 Looks up the specified setting in the map. More...
 
void setConfig (const string &inSetting, const Config &inConfig)
 Sets the configuration for the given setting. More...
 
void setConfig (const string &inSetting, const string &inName, const string &inValue)
 Sets the configuration for the given setting. More...
 
bool removeConfig (const string &inSetting)
 Removes the named configuration. More...
 
void addConfigs (const ConfigMap &inConfigMap)
 Merges the configurations from the given ConfigMap into this one. More...
 
std::pair< iterator, iterator > getMultiConfigValues (const string &inSetting)
 Returns a range that encompasses all of the configurations for the given setting. More...
 
size_type getMultiConfigCount (const string &inSetting)
 Returns the number of configurations for the given setting. More...
 

Static Public Member Functions

static bool allowConfigDuplicates (const string &inSetting)
 Returns true if multiple configurations are allowed for the given setting. More...
 

Protected Types

typedef std::string string
 Imported type name. More...
 
typedef std::multimap
< std::string, Config
super
 Convenience typedef to represent our superclass. More...
 

Protected Attributes

SequenceIndex mNextSequenceIndex
 Sequence index to use for the next configuration added to this map. More...
 

Detailed Description

Configuration setting map.

A configuration map is a collection of {setting:name:value} triplets, used to represent additional information for netlist design elements. Every physical netlist element that can be configured inherits from this class: Design, Module, Instance, Net.

Special Xilinx settings beginning with underscores are permitted to exist multiple times in the same ConfigMap. This is consistent with XDL usage, particularly in the case of XDL design statements.

Note
The name mentioned here is a user-specified name stemming from the design. It is not the configuration setting name. For example, in configuration "DFF:blink:#FF", "DFF" is the specified setting, "blink" is the name that the design assigns to the corresponding resource, and "#FF" is the value to which "DFF" is set.

Definition at line 39 of file ConfigMap.hpp.

Member Typedef Documentation

Constant iterator to {setting,Config} pairs.

Definition at line 52 of file ConfigMap.hpp.

typedef std::string torc::physical::ConfigMap::string
protected

Imported type name.

Definition at line 43 of file ConfigMap.hpp.

typedef std::multimap<std::string, Config> torc::physical::ConfigMap::super
protected

Convenience typedef to represent our superclass.

Definition at line 45 of file ConfigMap.hpp.

Constructor & Destructor Documentation

torc::physical::ConfigMap::ConfigMap ( void  )
inline

Null constructor.

Definition at line 55 of file ConfigMap.hpp.

std::multimap< std::string, Config > super
Convenience typedef to represent our superclass.
Definition: ConfigMap.hpp:45
SequenceIndex mNextSequenceIndex
Sequence index to use for the next configuration added to this map.
Definition: ConfigMap.hpp:48

Member Function Documentation

void torc::physical::ConfigMap::addConfigs ( const ConfigMap inConfigMap)
inline

Merges the configurations from the given ConfigMap into this one.

For each setting, if the setting does not already exist in the map, it is added. If the setting does exist, then the incoming configuration either replaces the existing setting (in the case of regular settings), or is added to the map (in the case of special settings for which multiple configurations are allowed).

Todo:
Acquire mutex.
Todo:
Release mutex.

Definition at line 159 of file ConfigMap.hpp.

159  {
160  if(inConfigMap.empty()) return;
161  /// \todo Acquire mutex.
162  const_iterator p = inConfigMap.begin();
163  const_iterator e = inConfigMap.end();
164  while(p != e) {
165  // look up the config information
166  const string& setting = p->first;
167  const Config& config = p->second;
168  // try to insert the setting into the map (while respecting our special semantics)
169  setConfig(setting, config);
170  p++;
171  }
172  /// \todo Release mutex.
173  }
void setConfig(const string &inSetting, const Config &inConfig)
Sets the configuration for the given setting.
Definition: ConfigMap.hpp:119
const_iterator const_iterator
Constant iterator to {setting,Config} pairs.
Definition: ConfigMap.hpp:52

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool torc::physical::ConfigMap::allowConfigDuplicates ( const string inSetting)
inlinestatic

Returns true if multiple configurations are allowed for the given setting.

Special Xilinx settings prefixed with an underscore may have multiple configurations in the map.

Definition at line 177 of file ConfigMap.hpp.

177  {
178  return inSetting.size() >= 1 && inSetting[0] == '_';
179  }

+ Here is the caller graph for this function:

void torc::physical::ConfigMap::clearConfig ( void  )
inline

Clears the configuration map.

Definition at line 67 of file ConfigMap.hpp.

67 { ConfigMap::clear(); }

+ Here is the caller graph for this function:

const_iterator torc::physical::ConfigMap::configBegin ( void  ) const
inline

Returns the begin constant iterator for configurations.

Definition at line 58 of file ConfigMap.hpp.

58 { return super::begin(); }

+ Here is the caller graph for this function:

const_iterator torc::physical::ConfigMap::configEnd ( void  ) const
inline

Returns the end constant iterator for configurations.

Definition at line 60 of file ConfigMap.hpp.

60 { return super::end(); }

+ Here is the caller graph for this function:

bool torc::physical::ConfigMap::configIsEmpty ( void  ) const
inline

Returns true if the configuration map is empty.

Definition at line 65 of file ConfigMap.hpp.

65 { return super::empty(); }

+ Here is the caller graph for this function:

bool torc::physical::ConfigMap::getConfig ( const string inSetting,
Config outConfig 
)
inline

Looks up the specified setting in the map.

Parameters
inSettingThe setting to query.
outConfigReference to a configuration to be populated if the setting exists in the map. Default values are used if the setting does not exist.
Note
If this is a special setting with multiple configuration entries, only the first one will be placed in outConfig.
Returns
true if the settings exists in the map, or false otherwise.

Definition at line 82 of file ConfigMap.hpp.

82  {
83  // employ friendship status to reach in and reference the config name and value members
84  return getConfig(inSetting, outConfig.mName, outConfig.mValue);
85  }
bool getConfig(const string &inSetting, Config &outConfig)
Looks up the specified setting in the map.
Definition: ConfigMap.hpp:82

+ Here is the caller graph for this function:

bool torc::physical::ConfigMap::getConfig ( const string inSetting,
string outName,
string outValue 
)
inline

Looks up the specified setting in the map.

Parameters
inSettingThe setting to query.
outNameReference to a string to accept the configuration name, or the default name if the setting does not exist.
outValueReference to a string to accept the configuration value, or the default value if the setting does not exist.
Note
If this is a special setting with multiple configuration entries, only the first one will be placed in outName and outValue.
Returns
true if the settings exists in the map, or false otherwise.
Todo:
Acquire mutex.
Todo:
Release mutex.

Definition at line 95 of file ConfigMap.hpp.

95  {
96  /// \todo Acquire mutex.
97  iterator result = find(inSetting);
98  if(result == end()) {
99  // if the key doesn't exist, return default values
100  outName = Config::sConfigDefaultName;
101  outValue = Config::sConfigDefaultValue;
102  return false;
103  } else {
104  // otherwise return the config data
105  Config& config = result->second;
106  outName = config.getName();
107  outValue = config.getValue();
108  return true;
109  }
110  /// \todo Release mutex.
111  }
static const char * sConfigDefaultValue
Default configuration value.
Definition: Config.hpp:53
static const char * sConfigDefaultName
Default configuration name.
Definition: Config.hpp:51

+ Here is the call graph for this function:

size_t torc::physical::ConfigMap::getConfigCount ( void  ) const
inline

Returns the number of configurations in the map.

Definition at line 63 of file ConfigMap.hpp.

63 { return super::size(); }

+ Here is the caller graph for this function:

size_type torc::physical::ConfigMap::getMultiConfigCount ( const string inSetting)
inline

Returns the number of configurations for the given setting.

Definition at line 186 of file ConfigMap.hpp.

186 { return count(inSetting); }

+ Here is the caller graph for this function:

std::pair<iterator, iterator> torc::physical::ConfigMap::getMultiConfigValues ( const string inSetting)
inline

Returns a range that encompasses all of the configurations for the given setting.

Returns
An iterator pair that encompasses all configurations for the setting. Refer to std::pair to determine how to extract the iterators.

Definition at line 183 of file ConfigMap.hpp.

184  { return equal_range(inSetting); }

+ Here is the caller graph for this function:

bool torc::physical::ConfigMap::hasConfig ( const string inSetting) const
inline

Returns true if the specified setting exists in the map.

Todo:
Acquire mutex.
Todo:
Release mutex.

Definition at line 69 of file ConfigMap.hpp.

69  {
70  /// \todo Acquire mutex.
71  const_iterator result = find(inSetting);
72  return result != end();
73  /// \todo Release mutex.
74  }
const_iterator const_iterator
Constant iterator to {setting,Config} pairs.
Definition: ConfigMap.hpp:52

+ Here is the caller graph for this function:

bool torc::physical::ConfigMap::removeConfig ( const string inSetting)
inline

Removes the named configuration.

Parameters
inSettingThe configuration to remove.
Returns
true if the configuration was removed, or false if the configuration did not exist.
Todo:
Acquire mutex.
Todo:
Release mutex.

Definition at line 145 of file ConfigMap.hpp.

145  {
146  /// \todo Acquire mutex.
147  iterator e = end();
148  iterator result = super::find(inSetting);
149  if(result == e) return false;
150  erase(result);
151  /// \todo Release mutex.
152  return true;
153  }
void torc::physical::ConfigMap::setConfig ( const string inSetting,
const Config inConfig 
)
inline

Sets the configuration for the given setting.

If this is a regular setting, then any existing configuration for the setting will be replaced, but if this is a special setting for which multiple configurations are allowed, it will be added to the map alongside the existing configurations.

Parameters
inSettingThe setting of interest.
inConfigThe configuration to set.

Definition at line 119 of file ConfigMap.hpp.

119  {
120  setConfig(inSetting, inConfig.getName(), inConfig.getValue());
121  }
void setConfig(const string &inSetting, const Config &inConfig)
Sets the configuration for the given setting.
Definition: ConfigMap.hpp:119

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::physical::ConfigMap::setConfig ( const string inSetting,
const string inName,
const string inValue 
)
inline

Sets the configuration for the given setting.

If this is a regular setting, then any existing configuration for the setting will be replaced, but if this is a special setting for which multiple configurations are allowed, it will be added to the map alongside the existing configurations.

Parameters
inSettingThe setting of interest.
inNameThe configuration name to set.
inValueThe configuration value to set.
Todo:
Acquire mutex.
Todo:
Release mutex.

Definition at line 130 of file ConfigMap.hpp.

130  {
131  /// \todo Acquire mutex.
132  // if duplicates are disallowed for this setting, erase any matching entries
133  if(!allowConfigDuplicates(inSetting)) {
134  std::pair<iterator, iterator> range = equal_range(inSetting);
135  if(range.first != range.second) erase(range.first, range.second);
136  }
137  // insert the config entry
138  insert(make_pair(inSetting, Config(inName, inValue, mNextSequenceIndex++)));
139  /// \todo Release mutex.
140  }
static bool allowConfigDuplicates(const string &inSetting)
Returns true if multiple configurations are allowed for the given setting.
Definition: ConfigMap.hpp:177
SequenceIndex mNextSequenceIndex
Sequence index to use for the next configuration added to this map.
Definition: ConfigMap.hpp:48

+ Here is the call graph for this function:

Field Documentation

SequenceIndex torc::physical::ConfigMap::mNextSequenceIndex
protected

Sequence index to use for the next configuration added to this map.

Definition at line 48 of file ConfigMap.hpp.


The documentation for this class was generated from the following file: