Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Config Class Reference

the root configuration object, provides some global functionality like porting pathnames (portPath()) More...

#include <Config.h>

Inheritance diagram for Config:

Detailed Description

the root configuration object, provides some global functionality like porting pathnames (portPath())

Definition at line 100 of file Config.h.

List of all members.

Classes

class  behaviors_config
 place for users to put their own configuration More...
class  controller_config
 controller information More...
class  main_config
 general configuration options More...
class  motion_config
 motion information More...
class  sound_config
 sound information More...
class  vision_config
 vision configuration options (this is a *big* section, with sub-sections) More...
class  wireless_config
 wireless configuration options More...

Public Types

enum  transports { UDP, TCP }

Public Member Functions

 Config (const std::string &filename="")
void setFileSystemRoot (const std::string &fsr)
 sets fsRoot
const std::string & getFileSystemRoot () const
 returns fsRoot
std::string portPath (const std::string &path) const
 returns a portable version of path which should be usable on either the simulator or the robot
std::string makePath (const std::string &name) const
 returns an absolute path if is relative (to root), otherwise just name
std::string searchPath (const std::string &name, const std::string &root) const
 searches for name at root/target/name, root/name, and finally just name, returns root/target/name if not found.
virtual void saveXML (xmlNode *node, bool onlyOverwrite, std::set< std::string > &seen) const
 saves the dictionary into the specified node
virtual unsigned int loadBuffer (const char buf[], unsigned int len, const char *filename=NULL)
 Load from a saved buffer in memory.
virtual unsigned int loadFile (const char *filename)
 initiate opening of the specified file and loading/saving of all appropriate information.
virtual unsigned int loadFileStream (FILE *f, const char *filename=NULL)
 Used recursively on member objects once a file is already open - DON'T CLOSE the file in your overridden functions.
void * setValue (const std::string &section, std::string key, const std::string &value)
 pass the section, item name string, item value string - sets the value and returns pointer to the item changed

Public Attributes

Config::behaviors_config behaviors
 place for users to put their own configuration
Config::wireless_config wireless
 wireless configuration options
Config::main_config main
 general configuration options
Config::controller_config controller
 controller information
Config::vision_config vision
 vision configuration options (this is a *big* section, with sub-sections)
Config::motion_config motion
 motion information
Config::sound_config sound
 sound information

Static Public Attributes

static const unsigned int NUM_TRANSPORTS = 2
 number of transports available
static const char * transport_names [NUM_TRANSPORTS+1] = { "UDP", "TCP", NULL }
 string names for transports

Protected Member Functions

unsigned int loadOldFormat (const char buf[], unsigned int len)
unsigned int loadOldFormat (FILE *f)
void parseLine (const char buf[], unsigned int lineno, std::vector< std::string > &modelStack, bool &ignoring, std::string &section)

Static Protected Member Functions

static char localeToLower (char c)

Protected Attributes

std::string fsRoot
 a prefix representing the file system root, usually indicating the robot's storage root.

Static Protected Attributes

static const char * xmlIntro1 = "<?xml version"
static const char * xmlIntro2 = "<!DOCTYPE "
static const char * xmlIntro3 = "<plist"
static const std::locale & curLocale = std::locale::classic()

Member Enumeration Documentation

Enumerator:
UDP 
TCP 

Definition at line 116 of file Config.h.


Constructor & Destructor Documentation

Config::Config ( const std::string &  filename = ""  ) 

Definition at line 102 of file Config.h.


Member Function Documentation

const std::string& Config::getFileSystemRoot (  )  const

returns fsRoot

Definition at line 121 of file Config.h.

Referenced by CameraData::loadCameraData(), KoduConfig::loadFile(), and CameraData::saveCameraData().

unsigned int Config::loadBuffer ( const char  buf[],
unsigned int  len,
const char *  filename = NULL 
) [virtual]

Load from a saved buffer in memory.

Parameters:
buf pointer to the memory where you should begin loading
len length of buf available (this isn't necessarily all yours, there might be other things following your data)
Returns:
the number of bytes actually used

Reimplemented from XMLLoadSave.

Definition at line 195 of file Config.cc.

unsigned int Config::loadFile ( const char *  filename  )  [virtual]

initiate opening of the specified file and loading/saving of all appropriate information.

Parameters:
filename the file to load/save
Returns:
number of bytes read/written, 0 if error (or empty)

Reimplemented from XMLLoadSave.

Definition at line 201 of file Config.cc.

Referenced by Config().

unsigned int Config::loadFileStream ( FILE *  f,
const char *  filename = NULL 
) [virtual]

Used recursively on member objects once a file is already open - DON'T CLOSE the file in your overridden functions.

Parameters:
f a pointer to the file to load
Returns:
number of bytes read, 0 if error (or empty)

Reimplemented from XMLLoadSave.

Definition at line 228 of file Config.cc.

unsigned int Config::loadOldFormat ( FILE *  f  )  [protected]

Definition at line 417 of file Config.cc.

unsigned int Config::loadOldFormat ( const char  buf[],
unsigned int  len 
) [protected]

Definition at line 402 of file Config.cc.

Referenced by loadBuffer(), loadFile(), and loadFileStream().

static char Config::localeToLower ( char  c  )  [static, protected]

Definition at line 702 of file Config.h.

std::string Config::makePath ( const std::string &  name  )  const

returns an absolute path if is relative (to root), otherwise just name

Definition at line 127 of file Config.h.

Referenced by GaitedFootstepMC::GaitedFootstepMC(), Kinematics::init(), and XWalkMC::XWalkMC().

void Config::parseLine ( const char  buf[],
unsigned int  lineno,
std::vector< std::string > &  modelStack,
bool &  ignoring,
std::string &  section 
) [protected]

Definition at line 432 of file Config.cc.

Referenced by loadOldFormat().

void Config::saveXML ( xmlNode node,
bool  onlyOverwrite,
std::set< std::string > &  seen 
) const [virtual]

saves the dictionary into the specified node

Parameters:
[in] node the xml node which should be saved into
[in] onlyOverwrite if is true, only saves entries for keys already found in the node (this overrides the current savePolicy value)
[in] seen used to keep track of which nodes have been seen in node -- may be of particular interest with onlyOverride set

seen is not cleared before being used.

Reimplemented from plist::DictionaryBase.

Definition at line 155 of file Config.cc.

std::string Config::searchPath ( const std::string &  name,
const std::string &  root 
) const

searches for name at root/target/name, root/name, and finally just name, returns root/target/name if not found.

Definition at line 549 of file Config.cc.

Referenced by Config::motion_config::makePath(), and makePath().

void Config::setFileSystemRoot ( const std::string &  fsr  ) 

sets fsRoot

Definition at line 255 of file Config.cc.

void * Config::setValue ( const std::string &  section,
std::string  key,
const std::string &  value 
)

pass the section, item name string, item value string - sets the value and returns pointer to the item changed

this is the older deprecated interface -- use the inherited resolveEntry() instead to support sub-sections

Definition at line 289 of file Config.cc.

Referenced by parseLine(), and Controller::setConfig().


Member Data Documentation

place for users to put their own configuration

you can dynamically "link in" external configuration settings by passing them to the addEntry() of the plist::Dictionary superclass. You may want to call writeParseTree() first to flush current settings, and then readParseTree() afterward to pull any pre-existing values from the configuration file into the instances you've just registered.

Of course, you could also just write your values into the configuration file first, and just rely on getEntry/setEntry to read/write the value. This may be more convenient if you use the value infrequently and don't need an instance of it sitting around.

Referenced by Config(), FlashIPAddrBehavior::doStart(), and FlashIPAddrBehavior::setupSequence().

const std::locale & Config::curLocale = std::locale::classic() [static, protected]

Definition at line 701 of file Config.h.

Referenced by localeToLower().

std::string Config::fsRoot [protected]

a prefix representing the file system root, usually indicating the robot's storage root.

When running in the simulator, this is used to pretend that a subdirectory in the project folder (e.g. 'ms') is the root file system

Definition at line 710 of file Config.h.

Referenced by getFileSystemRoot(), portPath(), and setFileSystemRoot().

const unsigned int Config::NUM_TRANSPORTS = 2 [static]

number of transports available

Definition at line 117 of file Config.h.

const char * Config::transport_names = { "UDP", "TCP", NULL } [static]

string names for transports

Definition at line 118 of file Config.h.

wireless configuration options

Referenced by Config().

const char * Config::xmlIntro1 = "<?xml version" [static, protected]

Definition at line 697 of file Config.h.

Referenced by loadBuffer(), loadFile(), and loadFileStream().

const char * Config::xmlIntro2 = "<!DOCTYPE " [static, protected]

Definition at line 698 of file Config.h.

Referenced by loadBuffer(), loadFile(), and loadFileStream().

const char * Config::xmlIntro3 = "<plist" [static, protected]

Definition at line 699 of file Config.h.

Referenced by loadBuffer(), loadFile(), and loadFileStream().


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