cConfigurationEx Class Reference
[Extension interfaces]

Represents a configuration suitable for use with the Envir library. More...

#include <cconfiguration.h>

Inheritance diagram for cConfigurationEx:
cConfiguration cObject

List of all members.

Public Member Functions

virtual void initializeFrom (cConfiguration *bootConfig)=0
virtual const char * getFileName () const =0
virtual void validate (const char *ignorableConfigKeys=NULL) const =0
Activating a configuration

virtual std::vector< std::string > getConfigNames ()=0
virtual void activateConfig (const char *configName, int runNumber=0)=0
virtual std::string getConfigDescription (const char *configName) const =0
virtual std::vector< std::string > getBaseConfigs (const char *configName) const =0
virtual std::vector< std::string > getConfigChain (const char *configName) const =0
virtual int getNumRunsInConfig (const char *configName) const =0
virtual std::vector< std::string > unrollConfig (const char *configName, bool detailed=true) const =0
virtual const char * getActiveConfigName () const =0
virtual int getActiveRunNumber () const =0
virtual const char * getVariable (const char *varname) const =0
virtual std::vector< const char * > getIterationVariableNames () const =0
virtual std::vector< const char * > getPredefinedVariableNames () const =0
virtual const char * getVariableDescription (const char *varname) const =0
virtual void dump () const =0
Getting values from the currently active configuration

virtual std::vector< const char * > getMatchingConfigKeys (const char *pattern) const =0
virtual const char * getParameterValue (const char *moduleFullPath, const char *paramName, bool hasDefaultValue) const =0
virtual const KeyValuegetParameterEntry (const char *moduleFullPath, const char *paramName, bool hasDefaultValue) const =0
virtual std::vector< const char * > getParameterKeyValuePairs () const =0
virtual std::vector< const char * > getMatchingPerObjectConfigKeys (const char *objectFullPath, const char *keySuffixPattern) const =0
virtual std::vector< const char * > getMatchingPerObjectConfigKeySuffixes (const char *objectFullPath, const char *keySuffixPattern) const =0

Detailed Description

Represents a configuration suitable for use with the Envir library.

This class extends cConfiguration with the following functionality:

See also:
cEnvir::getConfigEx()

Member Function Documentation

virtual void cConfigurationEx::activateConfig ( const char *  configName,
int  runNumber = 0 
) [pure virtual]

Activates the [Config <name>] section.

If it does not exist, an error is thrown. [General] is treated as short for [Config General]. The runNumber must be between 0 and getNumRunsInConfig(name)-1.

virtual int cConfigurationEx::getActiveRunNumber (  )  const [pure virtual]

Returns currently active run number.

This is the number passed to activateConfig(), or 0 if activateConfig() has not been called.

virtual std::vector<std::string> cConfigurationEx::getBaseConfigs ( const char *  configName  )  const [pure virtual]

Returns the names of the configurations the given configuration extends directly.

Only names of *existing* configurations are returned (that is, if "extends" is bogus and refers to a nonexistent configuration, this method omits that configuration name; also, "General" is only returned if such configuration actually exists.)

virtual std::vector<std::string> cConfigurationEx::getConfigChain ( const char *  configName  )  const [pure virtual]

Returns the names of the configurations the given configuration extends transitively.

This is the search order of parameter lookups from the given configuration. Only names of *existing* configurations are returned.

virtual const char* cConfigurationEx::getFileName (  )  const [pure virtual]

Returns the name of the configuration file.

Returns NULL if this object is not using a configuration file.

virtual std::vector<const char *> cConfigurationEx::getMatchingConfigKeys ( const char *  pattern  )  const [pure virtual]

Returns the list of config keys that match the given wildcard pattern.

The returned keys can be passed to getConfigValue().

virtual std::vector<const char *> cConfigurationEx::getMatchingPerObjectConfigKeys ( const char *  objectFullPath,
const char *  keySuffixPattern 
) const [pure virtual]

Returns the list of config keys that match the wildcard pattern objectFullPath + dot + keySuffixPattern.

objectFullPath may either be a concrete string without wildcards, or "**" to match anything. The returned keys may be used with getPerObjectConfigValue() to obtain the corresponding values.

virtual std::vector<const char *> cConfigurationEx::getMatchingPerObjectConfigKeySuffixes ( const char *  objectFullPath,
const char *  keySuffixPattern 
) const [pure virtual]

Like getMatchingPerObjectConfigKeys(), but returns the suffixes instead of the keys.

Note: the result may contain duplicates. The returned suffixes may be used with getPerObjectConfigValue() to obtain the corresponding values.

virtual int cConfigurationEx::getNumRunsInConfig ( const char *  configName  )  const [pure virtual]

Generates Cartesian product of all iterations within the given config, and counts them.

If the config does not exist, an error is thrown. [General] is treated as short for [Config General].

virtual const KeyValue& cConfigurationEx::getParameterEntry ( const char *  moduleFullPath,
const char *  paramName,
bool  hasDefaultValue 
) const [pure virtual]

Like getParameterValue(), but this one returns information about the whole inifile entry, not just the value string.

If the key is not found, a special KeyValue object is returned where both key and value are NULL.

Lifetime of the returned object might be limited, so clients should not store references to it. Copying the object is not allowed either, because KeyValue is a polymorphic type (object slicing!).

virtual std::vector<const char *> cConfigurationEx::getParameterKeyValuePairs (  )  const [pure virtual]

This method returns an array of the following form: (key1, value1, key2, value2,.

..), where keys and values correspond to parameter assignments in the configuration. This method is inefficient, and should not be used for anything else than writing the header of result files.

virtual const char* cConfigurationEx::getParameterValue ( const char *  moduleFullPath,
const char *  paramName,
bool  hasDefaultValue 
) const [pure virtual]

Looks up the value of the given parameter in the inifile.

The argument hasDefaultValue controls whether "=default" entries need to be considered. Return value is NULL if the parameter is not specified in the inifile, otherwise returns the string after the equal sign.

virtual std::vector<const char *> cConfigurationEx::getPredefinedVariableNames (  )  const [pure virtual]

Returns the names of all predefined variables in the activated configuration.

See getVariable().

virtual const char* cConfigurationEx::getVariable ( const char *  varname  )  const [pure virtual]

After activating a configuration, this method can be used to query iteration variables and predefined variables.

These are the variables that can be referred to using the "${...}" syntax in the configuration. If the variable does not exist, NULL is returned.

Some of the predefined variables are: "configname", "runnumber", "network", "processid", "datetime", "runid", "repetition", "iterationvars"; these names are also available as symbolic constants, see CFGVAR_CONFIGNAME and other CFGVAR_xxx names.

virtual const char* cConfigurationEx::getVariableDescription ( const char *  varname  )  const [pure virtual]

Returns the description of the given variable in the activated configuration.

Returns NULL if the variable does not exist or no description is available.

virtual void cConfigurationEx::initializeFrom ( cConfiguration bootConfig  )  [pure virtual]

Initializes configuration object from "boot-time" configuration (omnetpp.ini).

For example, if a particular cConfiguration subclass uses a database as data source, it may take the connection parameters from the "boot-time" configuration.

virtual std::vector<std::string> cConfigurationEx::unrollConfig ( const char *  configName,
bool  detailed = true 
) const [pure virtual]

Generates all runs in the given configuration, and returns a string for each.

When detailed==false, each run will generate a one-line string with the iteration variables; with detailed==true, each run generates a multi-line string containing the config entries that contain iterations or iteration variable references. This method is primarily for debugging purposes.

virtual void cConfigurationEx::validate ( const char *  ignorableConfigKeys = NULL  )  const [pure virtual]

Validates the configuration: reports obsolete config keys, cycles in the section fallback chain, unrecognized keys, etc as exceptions.

ignorableConfigKeys is the list of config keys whose presence in the configuration should not be reported as errors even if they are not declared using cConfigOptions. The list is space-separated, and items may contain wildcards. Typically, this list will contain "cmdenv-*" when Cmdenv is unavailable (not linked in), "tkenv-*" when Tkenv is unavailable, etc, so that validate() does not report those keys in omnetpp.ini as errors.


The documentation for this class was generated from the following file:
Generated on Fri Mar 7 17:19:40 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3