Privacy
An open-source, flexible 3D physical simulation framework
mars::cfg_manager::CFGManager Class Reference

#include <CFGManager.h>

Public Member Functions

 CFGManager (lib_manager::LibManager *theManager, const char *filename="mars_default.yaml")
 
 ~CFGManager ()
 
virtual int getLibVersion () const
 
virtual const std::string getLibName () const
 
 CREATE_MODULE_INFO ()
 
virtual bool loadConfigFromStream (std::istream &in, const char *group)
 
virtual bool loadConfig (const char *filename)
 
virtual bool loadConfig (const char *filename, const char *group)
 
virtual bool loadConfigFromString (const std::string &configString)
 
virtual void writeConfig (const char *filename, const char *group=NULL, const unsigned char saveOption=saveOnClose) const
 
virtual const std::string writeConfigToString (const char *group=NULL, const unsigned char saveOption=saveOnClose) const
 
virtual cfgParamId createParam (const std::string &_group, const std::string &_name, const cfgParamType &_paramType)
 
virtual bool removeParam (const cfgParamId &_id)
 
virtual bool removeParam (const std::string &_group, const std::string &_name)
 
virtual bool setProperty (const CFGProperty &_property)
 
virtual bool getProperty (CFGProperty *_property) const
 
virtual bool setProperty (const cfgPropertyStruct &_propertyS)
 
virtual bool getProperty (cfgPropertyStruct *_propertyS) const
 
virtual bool getPropertyValue (cfgParamId paramId, const std::string &_propertyName, double *rValue) const
 
virtual bool getPropertyValue (cfgParamId paramId, const std::string &_propertyName, int *rValue) const
 
virtual bool getPropertyValue (cfgParamId paramId, const std::string &_propertyName, bool *rValue) const
 
virtual bool getPropertyValue (cfgParamId paramId, const std::string &_propertyName, std::string *rValue) const
 
virtual bool setPropertyValue (const std::string &_group, const std::string &_name, const std::string &_propertyName, const double rValue)
 
virtual bool setPropertyValue (const std::string &_group, const std::string &_name, const std::string &_propertyName, const int rValue)
 
virtual bool setPropertyValue (const std::string &_group, const std::string &_name, const std::string &_propertyName, const bool rValue)
 
virtual bool setPropertyValue (const std::string &_group, const std::string &_name, const std::string &_propertyName, const std::string &rValue)
 
virtual bool setPropertyValue (const std::string &_group, const std::string &_name, const std::string &_propertyName, const char *rValue)
 
virtual cfgParamId getParamId (const std::string &_group, const std::string &_name) const
 
virtual const cfgParamInfo getParamInfo (const cfgParamId &_id) const
 
virtual const cfgParamInfo getParamInfo (const std::string &_group, const std::string &_name) const
 
virtual cfgParamId registerToParam (const std::string &_group, const std::string &_name, CFGClient *client)
 
virtual bool registerToParam (const cfgParamId &_id, CFGClient *client)
 
virtual bool unregisterFromParam (const std::string &_group, const std::string &_name, CFGClient *client)
 
virtual bool unregisterFromParam (const cfgParamId &_id, CFGClient *client)
 
virtual bool registerToCFG (CFGClient *client)
 
virtual bool unregisterFromCFG (CFGClient *client)
 
virtual bool getAllParams (std::vector< cfgParamInfo > *allParams) const
 
virtual const cfgPropertyStruct getOrCreateProperty (const std::string &_group, const std::string &_name, bool val, CFGClient *newClient=NULL)
 
virtual const cfgPropertyStruct getOrCreateProperty (const std::string &_group, const std::string &_name, double val, CFGClient *newClient=NULL)
 
virtual const cfgPropertyStruct getOrCreateProperty (const std::string &_group, const std::string &_name, int val, CFGClient *newClient=NULL)
 
virtual const cfgPropertyStruct getOrCreateProperty (const std::string &_group, const std::string &_name, const std::string &val, CFGClient *newClient=NULL)
 
virtual const cfgPropertyStruct getOrCreateProperty (const std::string &_group, const std::string &_name, const char *val, CFGClient *newClient=NULL)
 
virtual void setProperty (const std::string &_group, const std::string &_name, bool val)
 
virtual void setProperty (const std::string &_group, const std::string &_name, double val)
 
virtual void setProperty (const std::string &_group, const std::string &_name, int val)
 
virtual void setProperty (const std::string &_group, const std::string &_name, const std::string &val)
 
virtual void setProperty (const std::string &_group, const std::string &_name, const char *val)
 
- Public Member Functions inherited from mars::cfg_manager::CFGManagerInterface
 CFGManagerInterface (lib_manager::LibManager *theManager)
 
 ~CFGManagerInterface ()
 
virtual void createModuleInfo ()
 
template<typename T >
bool getPropertyValue (const std::string &_group, const std::string &_name, const std::string &_propertyName, T *rValue) const
 
- Public Member Functions inherited from lib_manager::LibInterface
 LibInterface (LibManager *theManager)
 
virtual ~LibInterface (void)
 
ModuleInfo getModuleInfo () const
 
virtual void newLibLoaded (const std::string &libName)
 

Private Member Functions

cfgParamId getNextId ()
 
void insertParam (CFGParam *newParam)
 
void deleteParam (CFGParam *param)
 
bool getParam (CFGParam **param, const std::string &_group, const std::string &_name) const
 
bool getParam (CFGParam **param, const cfgParamId &_id) const
 
const cfgParamInfo getParamInfo (const CFGParam *param) const
 
void addedCFGParam (const cfgParamId &_id) const
 
void removedCFGParam (const cfgParamId &_id) const
 
bool fileExists (const std::string &strFilename) const
 
void readGroup (const std::string &group, const YAML::Node &paramNodes)
 

Private Attributes

cfgParamId nextId
 
mars::utils::Mutex mutexNextId
 
mapStringToParam cfgParamsByString
 
mapIdToParam cfgParamsById
 
mars::utils::Mutex mutexCFGParams
 
std::vector< CFGClient * > vecClients
 
mars::utils::Mutex mutexVecClients
 

Additional Inherited Members

- Protected Attributes inherited from lib_manager::LibInterface
LibManagerlibManager
 
ModuleInfo moduleInfo
 

Detailed Description

Definition at line 58 of file CFGManager.h.

Constructor & Destructor Documentation

◆ CFGManager()

mars::cfg_manager::CFGManager::CFGManager ( lib_manager::LibManager theManager,
const char *  filename = "mars_default.yaml" 
)

Definition at line 51 of file CFGManager.cpp.

◆ ~CFGManager()

mars::cfg_manager::CFGManager::~CFGManager ( )

Definition at line 63 of file CFGManager.cpp.

Member Function Documentation

◆ addedCFGParam()

void mars::cfg_manager::CFGManager::addedCFGParam ( const cfgParamId _id) const
inlineprivate

Definition at line 835 of file CFGManager.cpp.

◆ CREATE_MODULE_INFO()

mars::cfg_manager::CFGManager::CREATE_MODULE_INFO ( )

◆ createParam()

cfgParamId mars::cfg_manager::CFGManager::createParam ( const std::string &  _group,
const std::string &  _name,
const cfgParamType _paramType 
)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 203 of file CFGManager.cpp.

◆ deleteParam()

void mars::cfg_manager::CFGManager::deleteParam ( CFGParam param)
inlineprivate

Definition at line 767 of file CFGManager.cpp.

◆ fileExists()

bool mars::cfg_manager::CFGManager::fileExists ( const std::string &  strFilename) const
private

Definition at line 855 of file CFGManager.cpp.

◆ getAllParams()

bool mars::cfg_manager::CFGManager::getAllParams ( std::vector< cfgParamInfo > *  allParams) const
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 246 of file CFGManager.cpp.

◆ getLibName()

virtual const std::string mars::cfg_manager::CFGManager::getLibName ( ) const
inlinevirtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 68 of file CFGManager.h.

◆ getLibVersion()

virtual int mars::cfg_manager::CFGManager::getLibVersion ( ) const
inlinevirtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 66 of file CFGManager.h.

◆ getNextId()

cfgParamId mars::cfg_manager::CFGManager::getNextId ( )
private

Definition at line 670 of file CFGManager.cpp.

◆ getOrCreateProperty() [1/5]

virtual const cfgPropertyStruct mars::cfg_manager::CFGManager::getOrCreateProperty ( const std::string &  _group,
const std::string &  _name,
bool  val,
CFGClient newClient = NULL 
)
virtual

◆ getOrCreateProperty() [2/5]

virtual const cfgPropertyStruct mars::cfg_manager::CFGManager::getOrCreateProperty ( const std::string &  _group,
const std::string &  _name,
double  val,
CFGClient newClient = NULL 
)
virtual

◆ getOrCreateProperty() [3/5]

virtual const cfgPropertyStruct mars::cfg_manager::CFGManager::getOrCreateProperty ( const std::string &  _group,
const std::string &  _name,
int  val,
CFGClient newClient = NULL 
)
virtual

◆ getOrCreateProperty() [4/5]

virtual const cfgPropertyStruct mars::cfg_manager::CFGManager::getOrCreateProperty ( const std::string &  _group,
const std::string &  _name,
const std::string &  val,
CFGClient newClient = NULL 
)
virtual

◆ getOrCreateProperty() [5/5]

virtual const cfgPropertyStruct mars::cfg_manager::CFGManager::getOrCreateProperty ( const std::string &  _group,
const std::string &  _name,
const char *  val,
CFGClient newClient = NULL 
)
virtual

◆ getParam() [1/2]

bool mars::cfg_manager::CFGManager::getParam ( CFGParam **  param,
const std::string &  _group,
const std::string &  _name 
) const
inlineprivate

◆ getParam() [2/2]

bool mars::cfg_manager::CFGManager::getParam ( CFGParam **  param,
const cfgParamId _id 
) const
inlineprivate

Definition at line 803 of file CFGManager.cpp.

◆ getParamId()

cfgParamId mars::cfg_manager::CFGManager::getParamId ( const std::string &  _group,
const std::string &  _name 
) const
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 564 of file CFGManager.cpp.

◆ getParamInfo() [1/3]

const cfgParamInfo mars::cfg_manager::CFGManager::getParamInfo ( const cfgParamId _id) const
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 576 of file CFGManager.cpp.

◆ getParamInfo() [2/3]

virtual const cfgParamInfo mars::cfg_manager::CFGManager::getParamInfo ( const std::string &  _group,
const std::string &  _name 
) const
virtual

◆ getParamInfo() [3/3]

const cfgParamInfo mars::cfg_manager::CFGManager::getParamInfo ( const CFGParam param) const
inlineprivate

Definition at line 817 of file CFGManager.cpp.

◆ getProperty() [1/2]

bool mars::cfg_manager::CFGManager::getProperty ( CFGProperty _property) const
virtual

Definition at line 367 of file CFGManager.cpp.

◆ getProperty() [2/2]

bool mars::cfg_manager::CFGManager::getProperty ( cfgPropertyStruct _propertyS) const
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 338 of file CFGManager.cpp.

◆ getPropertyValue() [1/4]

virtual bool mars::cfg_manager::CFGManager::getPropertyValue ( cfgParamId  paramId,
const std::string &  _propertyName,
double *  rValue 
) const
virtual

◆ getPropertyValue() [2/4]

virtual bool mars::cfg_manager::CFGManager::getPropertyValue ( cfgParamId  paramId,
const std::string &  _propertyName,
int *  rValue 
) const
virtual

◆ getPropertyValue() [3/4]

virtual bool mars::cfg_manager::CFGManager::getPropertyValue ( cfgParamId  paramId,
const std::string &  _propertyName,
bool *  rValue 
) const
virtual

◆ getPropertyValue() [4/4]

virtual bool mars::cfg_manager::CFGManager::getPropertyValue ( cfgParamId  paramId,
const std::string &  _propertyName,
std::string *  rValue 
) const
virtual

◆ insertParam()

void mars::cfg_manager::CFGManager::insertParam ( CFGParam newParam)
inlineprivate

Definition at line 732 of file CFGManager.cpp.

◆ loadConfig() [1/2]

bool mars::cfg_manager::CFGManager::loadConfig ( const char *  filename)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 138 of file CFGManager.cpp.

◆ loadConfig() [2/2]

bool mars::cfg_manager::CFGManager::loadConfig ( const char *  filename,
const char *  group 
)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 142 of file CFGManager.cpp.

◆ loadConfigFromStream()

bool mars::cfg_manager::CFGManager::loadConfigFromStream ( std::istream &  in,
const char *  group 
)
virtual

Definition at line 85 of file CFGManager.cpp.

◆ loadConfigFromString()

bool mars::cfg_manager::CFGManager::loadConfigFromString ( const std::string &  configString)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 156 of file CFGManager.cpp.

◆ readGroup()

void mars::cfg_manager::CFGManager::readGroup ( const std::string &  group,
const YAML::Node &  paramNodes 
)
private

Definition at line 679 of file CFGManager.cpp.

◆ registerToCFG()

bool mars::cfg_manager::CFGManager::registerToCFG ( CFGClient client)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 646 of file CFGManager.cpp.

◆ registerToParam() [1/2]

virtual cfgParamId mars::cfg_manager::CFGManager::registerToParam ( const std::string &  _group,
const std::string &  _name,
CFGClient client 
)
virtual

◆ registerToParam() [2/2]

bool mars::cfg_manager::CFGManager::registerToParam ( const cfgParamId _id,
CFGClient client 
)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 607 of file CFGManager.cpp.

◆ removedCFGParam()

void mars::cfg_manager::CFGManager::removedCFGParam ( const cfgParamId _id) const
inlineprivate

Definition at line 845 of file CFGManager.cpp.

◆ removeParam() [1/2]

bool mars::cfg_manager::CFGManager::removeParam ( const cfgParamId _id)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 256 of file CFGManager.cpp.

◆ removeParam() [2/2]

virtual bool mars::cfg_manager::CFGManager::removeParam ( const std::string &  _group,
const std::string &  _name 
)
virtual

◆ setProperty() [1/7]

bool mars::cfg_manager::CFGManager::setProperty ( const CFGProperty _property)
virtual

Definition at line 356 of file CFGManager.cpp.

◆ setProperty() [2/7]

bool mars::cfg_manager::CFGManager::setProperty ( const cfgPropertyStruct _propertyS)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 307 of file CFGManager.cpp.

◆ setProperty() [3/7]

virtual void mars::cfg_manager::CFGManager::setProperty ( const std::string &  _group,
const std::string &  _name,
bool  val 
)
virtual

◆ setProperty() [4/7]

virtual void mars::cfg_manager::CFGManager::setProperty ( const std::string &  _group,
const std::string &  _name,
double  val 
)
virtual

◆ setProperty() [5/7]

virtual void mars::cfg_manager::CFGManager::setProperty ( const std::string &  _group,
const std::string &  _name,
int  val 
)
virtual

◆ setProperty() [6/7]

virtual void mars::cfg_manager::CFGManager::setProperty ( const std::string &  _group,
const std::string &  _name,
const std::string &  val 
)
virtual

◆ setProperty() [7/7]

virtual void mars::cfg_manager::CFGManager::setProperty ( const std::string &  _group,
const std::string &  _name,
const char *  val 
)
virtual

◆ setPropertyValue() [1/5]

virtual bool mars::cfg_manager::CFGManager::setPropertyValue ( const std::string &  _group,
const std::string &  _name,
const std::string &  _propertyName,
const double  rValue 
)
virtual

◆ setPropertyValue() [2/5]

virtual bool mars::cfg_manager::CFGManager::setPropertyValue ( const std::string &  _group,
const std::string &  _name,
const std::string &  _propertyName,
const int  rValue 
)
virtual

◆ setPropertyValue() [3/5]

virtual bool mars::cfg_manager::CFGManager::setPropertyValue ( const std::string &  _group,
const std::string &  _name,
const std::string &  _propertyName,
const bool  rValue 
)
virtual

◆ setPropertyValue() [4/5]

virtual bool mars::cfg_manager::CFGManager::setPropertyValue ( const std::string &  _group,
const std::string &  _name,
const std::string &  _propertyName,
const std::string &  rValue 
)
virtual

◆ setPropertyValue() [5/5]

virtual bool mars::cfg_manager::CFGManager::setPropertyValue ( const std::string &  _group,
const std::string &  _name,
const std::string &  _propertyName,
const char *  rValue 
)
virtual

◆ unregisterFromCFG()

bool mars::cfg_manager::CFGManager::unregisterFromCFG ( CFGClient client)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 654 of file CFGManager.cpp.

◆ unregisterFromParam() [1/2]

virtual bool mars::cfg_manager::CFGManager::unregisterFromParam ( const std::string &  _group,
const std::string &  _name,
CFGClient client 
)
virtual

◆ unregisterFromParam() [2/2]

bool mars::cfg_manager::CFGManager::unregisterFromParam ( const cfgParamId _id,
CFGClient client 
)
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 633 of file CFGManager.cpp.

◆ writeConfig()

void mars::cfg_manager::CFGManager::writeConfig ( const char *  filename,
const char *  group = NULL,
const unsigned char  saveOption = saveOnClose 
) const
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 162 of file CFGManager.cpp.

◆ writeConfigToString()

const std::string mars::cfg_manager::CFGManager::writeConfigToString ( const char *  group = NULL,
const unsigned char  saveOption = saveOnClose 
) const
virtual

Implements mars::cfg_manager::CFGManagerInterface.

Definition at line 169 of file CFGManager.cpp.

Member Data Documentation

◆ cfgParamsById

mapIdToParam mars::cfg_manager::CFGManager::cfgParamsById
private

Definition at line 193 of file CFGManager.h.

◆ cfgParamsByString

mapStringToParam mars::cfg_manager::CFGManager::cfgParamsByString
private

Definition at line 192 of file CFGManager.h.

◆ mutexCFGParams

mars::utils::Mutex mars::cfg_manager::CFGManager::mutexCFGParams
mutableprivate

Definition at line 194 of file CFGManager.h.

◆ mutexNextId

mars::utils::Mutex mars::cfg_manager::CFGManager::mutexNextId
mutableprivate

Definition at line 188 of file CFGManager.h.

◆ mutexVecClients

mars::utils::Mutex mars::cfg_manager::CFGManager::mutexVecClients
mutableprivate

Definition at line 197 of file CFGManager.h.

◆ nextId

cfgParamId mars::cfg_manager::CFGManager::nextId
private

Definition at line 187 of file CFGManager.h.

◆ vecClients

std::vector<CFGClient*> mars::cfg_manager::CFGManager::vecClients
private

Definition at line 196 of file CFGManager.h.


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