OMNeT++ Simulation Library  5.6.1
cConfigurationReader Class Referenceabstract

#include <cconfigreader.h>

Description

Abstract base class for configuration readers for SectionBasedConfiguration.

This class presents configuration contents as key-value pairs grouped into sections. This class does not try to make sense of section/key names.

The default implementation is InifileReader, but other variants (e.g. those that read the configuration from a database) can also be implemented.

Classes

class  KeyValue
 Abstract base class for representing a key-value pair in the configuration. More...
 

Public Member Functions

virtual ~cConfigurationReader ()
 
virtual void initializeFrom (cConfiguration *bootConfig)=0
 
virtual const char * getFileName () const =0
 
virtual const char * getDefaultBaseDirectory () const =0
 
virtual int getNumSections () const =0
 
virtual const char * getSectionName (int sectionId) const =0
 
virtual int getNumEntries (int sectionId) const =0
 
virtual const KeyValuegetEntry (int sectionId, int entryId) const =0
 
virtual void dump () const =0
 

Constructor & Destructor Documentation

◆ ~cConfigurationReader()

Member Function Documentation

◆ initializeFrom()

virtual void initializeFrom ( cConfiguration bootConfig)
pure virtual

Initializes the object from a "boot-time" configuration (omnetpp.ini). For example, if a particular cConfigurationReader class uses a database as data source, it may take the connection parameters from the "boot-time" configuration.

Referenced by cConfigurationReader::~cConfigurationReader().

◆ getFileName()

virtual const char* getFileName ( ) const
pure virtual

Returns the name of the configuration file. Returns nullptr if this object is not using a configuration file.

◆ getDefaultBaseDirectory()

virtual const char* getDefaultBaseDirectory ( ) const
pure virtual

Returns the directory defaulted filenames should be understood to be relative to. For example, if the name of the output vector file is not explicitly configured, it defaults to "omnetpp.vec" in the default base directory.

Referenced by cConfigurationReader::~cConfigurationReader().

◆ getNumSections()

virtual int getNumSections ( ) const
pure virtual

Returns the number of sections in the configuration.

Referenced by cConfigurationReader::~cConfigurationReader().

◆ getSectionName()

virtual const char* getSectionName ( int  sectionId) const
pure virtual

Returns the name of the given section. sectionId should be in 0..getNumSections()-1.

Referenced by cConfigurationReader::~cConfigurationReader().

◆ getNumEntries()

virtual int getNumEntries ( int  sectionId) const
pure virtual

Returns the number of entries in the given section. sectionId should be in 0..getNumSections()-1.

Referenced by cConfigurationReader::~cConfigurationReader().

◆ getEntry()

virtual const KeyValue& getEntry ( int  sectionId,
int  entryId 
) const
pure virtual

Returns the given entry in the in the given section. sectionId should be in 0..getNumSections()-1. The lifetime of the returned entry may be limited, so references to entries should not be cached.

Referenced by cConfigurationReader::~cConfigurationReader().

◆ dump()

virtual void dump ( ) const
pure virtual

Prints the configuration to the standard output. This can be useful for tracking down problems.

Referenced by cConfigurationReader::~cConfigurationReader().


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