cConfiguration Class Reference
[Extension interfaces]

Represents the configuration, as accessed by the simulation kernel. More...

#include <cconfiguration.h>

Inheritance diagram for cConfiguration:
cObject cConfigurationEx

List of all members.

Classes

class  KeyValue
 Describes a configuration entry. More...

Public Member Functions

String-based getters for configuration options

virtual const char * getConfigValue (const char *key) const =0
virtual const KeyValuegetConfigEntry (const char *key) const =0
virtual const char * getPerObjectConfigValue (const char *objectFullPath, const char *keySuffix) const =0
virtual const KeyValuegetPerObjectConfigEntry (const char *objectFullPath, const char *keySuffix) const =0
Getters for configuration options

virtual const char * getAsCustom (cConfigOption *option, const char *fallbackValue=NULL)
virtual bool getAsBool (cConfigOption *option, bool fallbackValue=false)
virtual long getAsInt (cConfigOption *option, long fallbackValue=0)
virtual double getAsDouble (cConfigOption *option, double fallbackValue=0)
virtual std::string getAsString (cConfigOption *option, const char *fallbackValue="")
virtual std::string getAsFilename (cConfigOption *option)
virtual std::vector< std::string > getAsFilenames (cConfigOption *option)
virtual std::string getAsPath (cConfigOption *option)
Getters for per-object configuration options

virtual const char * getAsCustom (const char *objectFullPath, cConfigOption *option, const char *fallbackValue=NULL)
virtual bool getAsBool (const char *objectFullPath, cConfigOption *option, bool fallbackValue=false)
virtual long getAsInt (const char *objectFullPath, cConfigOption *option, long fallbackValue=0)
virtual double getAsDouble (const char *objectFullPath, cConfigOption *option, double fallbackValue=0)
virtual std::string getAsString (const char *objectFullPath, cConfigOption *option, const char *fallbackValue="")
virtual std::string getAsFilename (const char *objectFullPath, cConfigOption *option)
virtual std::vector< std::string > getAsFilenames (const char *objectFullPath, cConfigOption *option)
virtual std::string getAsPath (const char *objectFullPath, cConfigOption *option)
Other methods

virtual const char * substituteVariables (const char *value)=0

Static Public Member Functions

Utility functions for parsing config entries

static bool parseBool (const char *s, const char *defaultValue, bool fallbackValue=false)
static long parseLong (const char *s, const char *defaultValue, long fallbackValue=0)
static double parseDouble (const char *s, const char *unit, const char *defaultValue, double fallbackValue=0)
static std::string parseString (const char *s, const char *defaultValue, const char *fallbackValue="")
static std::string parseFilename (const char *s, const char *baseDir, const char *defaultValue)
static std::vector< std::string > parseFilenames (const char *s, const char *baseDir, const char *defaultValue)
static std::string adjustPath (const char *s, const char *baseDir, const char *defaultValue)

Detailed Description

Represents the configuration, as accessed by the simulation kernel.

The configuration object can be accessed with ev.getConfig().

This class logically belongs to the cEnvir facade. (cEnvir presents to the simulation kernel the UI, or generally, the program which embeds the simulation.) This class provides access to configuration data for components such as scheduler classes, parallel simulation algorithms, etc. Model code (simple modules) should not directly read the configuration -- they should rely on module parameters for input.

This class does not deal with module parameters, because they get assigned via cEnvir's readParameter() method.

See also:
cConfigurationEx, cEnvir::getConfig()

Member Function Documentation

virtual bool cConfiguration::getAsBool ( const char *  objectFullPath,
cConfigOption option,
bool  fallbackValue = false 
) [virtual]

Returns a per-object config value as bool.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual bool cConfiguration::getAsBool ( cConfigOption option,
bool  fallbackValue = false 
) [virtual]

Returns a config value as bool.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual const char* cConfiguration::getAsCustom ( const char *  objectFullPath,
cConfigOption option,
const char *  fallbackValue = NULL 
) [virtual]

Returns a per-object config value without any conversion.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual const char* cConfiguration::getAsCustom ( cConfigOption option,
const char *  fallbackValue = NULL 
) [virtual]

Returns a config value without any conversion.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual double cConfiguration::getAsDouble ( const char *  objectFullPath,
cConfigOption option,
double  fallbackValue = 0 
) [virtual]

Returns a per-object config value as double.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual double cConfiguration::getAsDouble ( cConfigOption option,
double  fallbackValue = 0 
) [virtual]

Returns a config value as double.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual std::string cConfiguration::getAsFilename ( const char *  objectFullPath,
cConfigOption option 
) [virtual]

Interprets the per-object config value as a path.

If it is relative, then it will be converted to an absolute path, using the base directory (see KeyValue::getBaseDirectory()).

virtual std::string cConfiguration::getAsFilename ( cConfigOption option  )  [virtual]

Interprets the config value as a path.

If it is relative, then it will be converted to an absolute path, using the base directory (see the getBaseDirectoryFor() method).

virtual std::vector<std::string> cConfiguration::getAsFilenames ( const char *  objectFullPath,
cConfigOption option 
) [virtual]

Interprets the per-object config value as a list of paths (file or directory names, possibly containing wildcards), separated by spaces.

The relative paths in the list will be converted to absolute, using the base directory (see KeyValue::getBaseDirectory()).

virtual std::vector<std::string> cConfiguration::getAsFilenames ( cConfigOption option  )  [virtual]

Interprets the config value as a list of paths (file or directory names, possibly containing wildcards), separated by spaces.

The relative paths in the list will be converted to absolute, using the base directory (see getBaseDirectoryFor() method).

virtual long cConfiguration::getAsInt ( const char *  objectFullPath,
cConfigOption option,
long  fallbackValue = 0 
) [virtual]

Returns a per-object config value as long.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual long cConfiguration::getAsInt ( cConfigOption option,
long  fallbackValue = 0 
) [virtual]

Returns a config value as long.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual std::string cConfiguration::getAsPath ( const char *  objectFullPath,
cConfigOption option 
) [virtual]

Interprets the per-object config value as a list of directory names, possibly containing wildcards, and separated by ";" (Windows), or ":" or ";" (other OSes).

The relative names in the list will be converted to absolute, using the base directory (see getBaseDirectoryFor() method).

virtual std::string cConfiguration::getAsPath ( cConfigOption option  )  [virtual]

Interprets the config value as a list of directory names, possibly containing wildcards, and separated by ";" (Windows), or ":" or ";" (other OSes).

The relative names in the list will be converted to absolute, using the base directory (see getBaseDirectoryFor() method).

virtual std::string cConfiguration::getAsString ( const char *  objectFullPath,
cConfigOption option,
const char *  fallbackValue = "" 
) [virtual]

Returns a per-object config value as string.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual std::string cConfiguration::getAsString ( cConfigOption option,
const char *  fallbackValue = "" 
) [virtual]

Returns a config value as string.

fallbackValue is returned if the value is not specified in the configuration, and there is no default value.

virtual const KeyValue& cConfiguration::getConfigEntry ( const char *  key  )  const [pure virtual]

Like getConfigValue(), 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 const char* cConfiguration::getConfigValue ( const char *  key  )  const [pure virtual]

Returns a configuration value.

Valid keys do not contain dots or wildcard characters. Returns NULL if key is not found.

virtual const KeyValue& cConfiguration::getPerObjectConfigEntry ( const char *  objectFullPath,
const char *  keySuffix 
) const [pure virtual]

Like getPerObjectConfigValue(), 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 const char* cConfiguration::getPerObjectConfigValue ( const char *  objectFullPath,
const char *  keySuffix 
) const [pure virtual]

Returns a per-object configuration value.

Valid keysuffixes do not contain dots or wildcard characters. Returns NULL if key is not found. keySuffix is something like "vector-recording-intervals", "ev-output", etc.

virtual const char* cConfiguration::substituteVariables ( const char *  value  )  [pure virtual]

Substitutes ${} variables into the given string.

The resulting string is stored inside the configuration object.


The documentation for this class was generated from the following file:
Generated on Tue Dec 2 11:16:28 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3