readConfig Class Reference

open a config file and parse it for data retreaval More...

#include <Util/readConfig.H>

Collaboration diagram for readConfig:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 readConfig ()
 constructor with initial size = 25
 readConfig (int size)
 constructor with initial size
 ~readConfig ()
 destructor for readConfig
void openFile (const char *filename, bool echo=false)
 open a config file with filename
void writeFile ()
 write the file back to disk as filename
void writeFile (const char *filename)
 write the file back to disk with a new file name
bool readFileTrue (int itemNumber)
 returns true if item number itemNumber exists
int readFileValueI (int itemNumber)
 return value of item as an integer
float readFileValueF (int itemNumber)
 return value of item as a float
std::string readFileValueS (int itemNumber)
 return value of item as a string
const char * readFileValueC (int itemNumber)
 return value of item as a C style char*
std::string readFileValueName (int itemNumber)
 return the item name
const char * readFileValueNameC (int itemNumber)
 return item name as a C style char*
float readFileValueNameF (int itemNumber)
 return item name as a float
float getItemValueF (std::string itemName)
 return the float value of a number with name itemName
std::string getItemValueS (std::string itemName)
 return the string value of a number with name itemName
bool getItemValueB (std::string itemName)
 return a bool representation of the value 1 = true else false
const char * getItemValueC (std::string itemName)
 return the char* value of a number with name itemName
void setItemValue (std::string itemName, float _set)
 Set the item with string name itemName to a float _set.
void setItemValue (std::string itemName, std::string _set)
 Set the item with string name itemName to a string _set.
void setItemValue (std::string itemName, const char *_set)
 Set the item with string name itemName to a const char* _set.
void setFileValue (int itemNumber, float _set)
 Set the item signified by its number to a float.
void setFileValue (int itemNumber, std::string _set)
 Set the item signified by its number to a string.
void setFileValue (int itemNumber, const char *_set)
 Set the item signified by its number to a const char*.
int addItemValue (std::string itemName, float _set)
 Set the item with string name itemName to a float _set.
int addItemValue (std::string itemName, std::string _set)
 Set the item with string name itemName to a string _set.
int addItemValue (std::string itemName, const char *_set)
 Set the item with string name itemName to a string _set.
int itemCount ()
 returns how many items exist

Detailed Description

open a config file and parse it for data retreaval

This class works to open a file for parsing which has name value key pairs. Each pair is seperated and loaded into a vector. Values can then be retrieved by either calling a values item number or name. This will then return the value. Comments can be handeled in the config file so long as they are in the form '# words #'. That is place a # with a space before and after each comment.

Definition at line 64 of file readConfig.H.


Constructor & Destructor Documentation

readConfig::readConfig (  ) 

constructor with initial size = 25

Definition at line 51 of file readConfig.C.

readConfig::readConfig ( int  size  ) 

constructor with initial size

Definition at line 60 of file readConfig.C.

readConfig::~readConfig (  ) 

destructor for readConfig

Definition at line 68 of file readConfig.C.


Member Function Documentation

int readConfig::addItemValue ( std::string  itemName,
const char *  _set 
)

Set the item with string name itemName to a string _set.

Definition at line 361 of file readConfig.C.

References addItemValue().

int readConfig::addItemValue ( std::string  itemName,
std::string  _set 
)

Set the item with string name itemName to a string _set.

Definition at line 344 of file readConfig.C.

int readConfig::addItemValue ( std::string  itemName,
float  _set 
)

Set the item with string name itemName to a float _set.

Definition at line 339 of file readConfig.C.

References sformat().

Referenced by addItemValue().

bool readConfig::getItemValueB ( std::string  itemName  ) 
const char * readConfig::getItemValueC ( std::string  itemName  ) 

return the char* value of a number with name itemName

Definition at line 259 of file readConfig.C.

float readConfig::getItemValueF ( std::string  itemName  ) 
string readConfig::getItemValueS ( std::string  itemName  ) 

return the string value of a number with name itemName

Definition at line 222 of file readConfig.C.

Referenced by featureClusterVision< FLOAT >::fCVsetUpfCV(), SimulationViewerNerdCam::init(), and CINNICstatsRun::setConfig().

int readConfig::itemCount (  ) 

returns how many items exist

Definition at line 367 of file readConfig.C.

Referenced by CINNICstatsRun::runStandardStats(), and CINNICstatsRun::setStuff().

void readConfig::openFile ( const char *  filename,
bool  echo = false 
)
bool readConfig::readFileTrue ( int  itemNumber  ) 

returns true if item number itemNumber exists

Definition at line 151 of file readConfig.C.

Referenced by main(), CINNICstatsRun::runPointAndFlood(), and CINNICstatsRun::runStandardStats().

const char * readConfig::readFileValueC ( int  itemNumber  ) 

return value of item as a C style char*

Definition at line 181 of file readConfig.C.

References ASSERT.

Referenced by CINNICstatsRun::runPointAndFlood(), and CINNICstatsRun::runStandardStats().

float readConfig::readFileValueF ( int  itemNumber  ) 

return value of item as a float

Definition at line 169 of file readConfig.C.

References ASSERT.

Referenced by main().

int readConfig::readFileValueI ( int  itemNumber  ) 

return value of item as an integer

Definition at line 163 of file readConfig.C.

References ASSERT.

string readConfig::readFileValueName ( int  itemNumber  ) 

return the item name

Definition at line 187 of file readConfig.C.

References ASSERT.

Referenced by main().

const char * readConfig::readFileValueNameC ( int  itemNumber  ) 

return item name as a C style char*

Definition at line 193 of file readConfig.C.

References ASSERT.

Referenced by CINNICstatsRun::runPointAndFlood(), and CINNICstatsRun::runStandardStats().

float readConfig::readFileValueNameF ( int  itemNumber  ) 

return item name as a float

Definition at line 199 of file readConfig.C.

References ASSERT.

string readConfig::readFileValueS ( int  itemNumber  ) 

return value of item as a string

Definition at line 175 of file readConfig.C.

References ASSERT.

void readConfig::setFileValue ( int  itemNumber,
const char *  _set 
)

Set the item signified by its number to a const char*.

Definition at line 333 of file readConfig.C.

References ASSERT.

void readConfig::setFileValue ( int  itemNumber,
std::string  _set 
)

Set the item signified by its number to a string.

Definition at line 327 of file readConfig.C.

References ASSERT.

void readConfig::setFileValue ( int  itemNumber,
float  _set 
)

Set the item signified by its number to a float.

Definition at line 321 of file readConfig.C.

References ASSERT, and sformat().

void readConfig::setItemValue ( std::string  itemName,
const char *  _set 
)

Set the item with string name itemName to a const char* _set.

Definition at line 306 of file readConfig.C.

void readConfig::setItemValue ( std::string  itemName,
std::string  _set 
)

Set the item with string name itemName to a string _set.

Definition at line 291 of file readConfig.C.

void readConfig::setItemValue ( std::string  itemName,
float  _set 
)

Set the item with string name itemName to a float _set.

Definition at line 276 of file readConfig.C.

References sformat().

void readConfig::writeFile ( const char *  filename  ) 

write the file back to disk with a new file name

Definition at line 138 of file readConfig.C.

void readConfig::writeFile (  ) 

write the file back to disk as filename

Definition at line 125 of file readConfig.C.


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:24:10 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3