Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ConfigDictionary Class Reference

a subclass of plist::Dictionary which adds support for filtering settings by robot model, each configuration section is based on this More...

#include <Config.h>

Inheritance diagram for ConfigDictionary:

Detailed Description

a subclass of plist::Dictionary which adds support for filtering settings by robot model, each configuration section is based on this

As a slight extension to standard plists, you can specify model-specific settings by prepending a key with: Model:MODEL_PATTERN:KEY_NAME For example, to use different 'thresh' settings on the ERS-2xx series vs. the ERS-7 model, you would use the keys:

  • Model:ERS-2*:thresh
  • Model:ERS-7:thresh You can filter several items as a group by leaving off the second ':' and name, and providing a dictionary as the value. If the model matches, all entries from the dictionary are imported into the parent dictionary.

Definition at line 36 of file Config.h.

List of all members.

Public Member Functions

 ConfigDictionary ()

Protected Member Functions

virtual bool loadXMLNode (const std::string &key, xmlNode *val, const std::string &comment)
 called with each node being loaded so subclass can handle appropriately
virtual bool saveOverXMLNode (xmlNode *k, xmlNode *val, const std::string &key, std::string comment, const std::string &indentStr, std::set< std::string > &seen) const
 called with each node being saved so subclass can handle appropriately, return true if successful and reset key if changed

Static Protected Member Functions

static bool matchNoCase (const std::string &model, const std::string &pattern)
 returns true if pattern matches model - pattern may have up to 1 '*', case insensitive
static void initCurModel ()
 function to initialize curModel

Static Protected Attributes

static const std::string msPrefix = "Model"
 the prefix indicating a model-specific key
static const std::string msSep = ":"
 the separator string which splits the key into the prefix, model pattern, and (optionally) a single key name
static std::string curModel
 will be set to the model identifier of the currently running hardware

Constructor & Destructor Documentation

ConfigDictionary::ConfigDictionary (  ) 

Definition at line 38 of file Config.h.


Member Function Documentation

static void ConfigDictionary::initCurModel (  )  [static, protected]

function to initialize curModel

bool ConfigDictionary::loadXMLNode ( const std::string &  name,
xmlNode val,
const std::string &  comment 
) [protected, virtual]

called with each node being loaded so subclass can handle appropriately

Reimplemented from plist::DictionaryOf< PO, Alloc >.

Reimplemented in OutputConfig< T >, and OutputConfig< plist::Primitive< float > >.

Definition at line 68 of file Config.cc.

bool ConfigDictionary::matchNoCase ( const std::string &  model,
const std::string &  pattern 
) [static, protected]

returns true if pattern matches model - pattern may have up to 1 '*', case insensitive

Definition at line 130 of file Config.cc.

Referenced by loadXMLNode(), Config::parseLine(), and saveOverXMLNode().

bool ConfigDictionary::saveOverXMLNode ( xmlNode k,
xmlNode val,
const std::string &  key,
std::string  comment,
const std::string &  indentStr,
std::set< std::string > &  seen 
) const [protected, virtual]

called with each node being saved so subclass can handle appropriately, return true if successful and reset key if changed

Reimplemented from plist::DictionaryBase.

Definition at line 98 of file Config.cc.


Member Data Documentation

std::string ConfigDictionary::curModel [static, protected]

will be set to the model identifier of the currently running hardware

Definition at line 55 of file Config.h.

Referenced by ConfigDictionary(), loadXMLNode(), Config::parseLine(), and saveOverXMLNode().

const std::string ConfigDictionary::msPrefix = "Model" [static, protected]

the prefix indicating a model-specific key

Definition at line 52 of file Config.h.

Referenced by loadXMLNode(), and saveOverXMLNode().

const std::string ConfigDictionary::msSep = ":" [static, protected]

the separator string which splits the key into the prefix, model pattern, and (optionally) a single key name

Definition at line 53 of file Config.h.

Referenced by loadXMLNode(), and saveOverXMLNode().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:06 2016 by Doxygen 1.6.3