#include <ArConfig.h>
Inheritance diagram for ArConfig:
Public Member Functions | |
bool | addComment (const char *comment, const char *sectionName="", ArPriority::Priority priority=ArPriority::NORMAL) |
Command to add a new comment to the given section with given priority. | |
bool | addParam (const ArConfigArg &arg, const char *sectionName="", ArPriority::Priority priority=ArPriority::NORMAL) |
Command to add a parameter to the given section with given priority. | |
void | addProcessFileCB (ArRetFunctor< bool > *functor, int priority=0) |
Adds a processedFile callback. | |
void | addProcessFileWithErrorCB (ArRetFunctor2< bool, char *, size_t > *functor, int priority=0) |
Adds a processedFile callback with error messages. | |
ArConfig (const ArConfig &config) | |
Copy constructor. | |
ArConfig (const char *baseDirectory=NULL, bool noBlanksBetweenParams=false, bool ignoreBounds=false, bool failOnBadSection=false) | |
Constructor. | |
bool | callProcessFileCallBacks (bool continueOnError, char *errorBuffer, size_t errorBufferLen) |
Call the processFileCBs. | |
void | clearAll (void) |
Clears out all the section information and the processFileCBs. | |
void | clearSections (void) |
Clears out all the section information. | |
ArConfigSection * | findSection (const char *sectionName) const |
Finds the section with the given name. Returns NULL if not found. | |
const char * | getBaseDirectory (void) const |
Gets the base directory. | |
const char * | getFileName (void) const |
Gets the file name we loaded. | |
bool | getNoBlanksBetweenParams (void) |
Get whether we have blanks between the params or not. | |
ArLog::LogLevel | getProcessFileCallbacksLogLevel (void) |
Gets the level we log our map changed callback at. | |
std::list< ArConfigSection * > * | getSections (void) |
Gets the sections themselves (use only if you know what to do). | |
ArConfig & | operator= (const ArConfig &config) |
bool | parseArgument (ArArgumentBuilder *arg, char *errorBuffer=NULL, size_t errorBufferLen=0) |
This parses the argument given (for parser or other use). | |
bool | parseArgumentParser (ArArgumentParser *parser, bool continueOnError=false, char *errorBuffer=NULL, size_t errorBufferLen=0) |
Uses an argument parser to change the config. | |
bool | parseFile (const char *fileName, bool continueOnError=false, bool noFileNotFoundMessage=false, char *errorBuffer=NULL, size_t errorBufferLen=0) |
Parse a config file. | |
bool | parseSection (ArArgumentBuilder *arg, char *errorBuffer=NULL, size_t errorBufferLen=0) |
This parses the section change (for parser or other use). | |
virtual bool | processFile (void) |
for inheritors this is called after the file is processed | |
void | remProcessFileCB (ArRetFunctor2< bool, char *, size_t > *functor) |
Removes a processedFile callback. | |
void | remProcessFileCB (ArRetFunctor< bool > *functor) |
Removes a processedFile callback. | |
void | setBaseDirectory (const char *baseDirectory) |
Sets the base directory. | |
void | setNoBlanksBetweenParams (bool noBlanksBetweenParams) |
Set whether we have blanks between the params or not. | |
void | setProcessFileCallbacksLogLevel (ArLog::LogLevel level) |
Sets the level we log our map changed callback at. | |
void | setSectionComment (const char *sectionName, const char *comment) |
Sets the comment for a section. | |
void | useArgumentParser (ArArgumentParser *parser) |
Uses this argument parser after it parses a file before it processes. | |
bool | writeFile (const char *fileName, bool append=false, std::set< std::string > *alreadyWritten=NULL, bool writePriorities=false) |
Write out a config file with defaults. | |
virtual | ~ArConfig () |
Destructor. | |
Protected Member Functions | |
void | addParserHandlers (void) |
Protected Attributes | |
ArArgumentParser * | myArgumentParser |
std::string | myBaseDirectory |
bool | myDuplicateParams |
bool | myFailOnBadSection |
std::string | myFileName |
bool | myIgnoreBounds |
bool | myNoBlanksBetweenParams |
ArFileParser | myParser |
ArRetFunctor3C< bool, ArConfig, ArArgumentBuilder *, char *, size_t > | myParserCB |
ArLog::LogLevel | myProcessFileCallbacksLogLevel |
std::multimap< int, ProcessFileCBType * > | myProcessFileCBList |
std::string | mySection |
bool | mySectionBroken |
ArRetFunctor3C< bool, ArConfig, ArArgumentBuilder *, char *, size_t > | mySectionCB |
std::list< ArConfigSection * > | mySections |
bool | myUsingSections |
Classes | |
class | ProcessFileCBType |
Definition at line 41 of file ArConfig.h.
|
Constructor.
Definition at line 39 of file ArConfig.cpp. References ArFileParser::addHandlerWithError(), ArLog::log(), and setBaseDirectory(). |
|
Command to add a new comment to the given section with given priority.
Definition at line 267 of file ArConfig.cpp. References addParam(). Referenced by ArRobotParams::ArRobotParams(). |
|
Adds a processedFile callback. After a file has been read all the way these processFileCBs are called in the priority (higher numbers first)... these are only called if there were no errors parsing the file or continueOnError was set to false when parseFile was called The functor should return true if the config parsed was good (parseFile will return true) false if the config parsed wasn't (parseFile will return false)
Definition at line 933 of file ArConfig.cpp. |
|
Adds a processedFile callback with error messages. This function has a different name than addProcessFileCB just so that if you mean to get this function but have the wrong functor you'll get an error. The rem's are the same though since that shouldn't matter. After a file has been read all the way these processFileCBs are called in the priority (higher numbers first)... these are only called if there were no errors parsing the file or continueOnError was set to false when parseFile was called The functor should return true if the config parsed was good (parseFile will return true) false if the config parsed wasn't (parseFile will return false)
Definition at line 984 of file ArConfig.cpp. Referenced by ArMap::ArMap(). |
|
This parses the argument given (for parser or other use). The extra string of the parser should be set to the command wanted, while the rest of the arg should be the arguments to the command. Its case insensitive.
Definition at line 349 of file ArConfig.cpp. References ArConfigArg::getName(), ArConfigSection::getName(), ArConfigSection::getParams(), ArConfigArg::getString(), ArConfigArg::getType(), ArLog::log(), ArConfigArg::setArgWithFunctor(), ArConfigArg::setBool(), ArConfigArg::setDouble(), ArConfigArg::setInt(), ArConfigArg::setString(), and ArUtil::strcasecmp(). Referenced by parseArgumentParser(). |
|
Parse a config file.
Definition at line 564 of file ArConfig.cpp. References callProcessFileCallBacks(), parseArgumentParser(), and ArFileParser::parseFile(). Referenced by ArRobot::loadParamFile(), and ArRobot::madeConnection(). |
|
This parses the section change (for parser or other use). The extra string of the parser should be set to the 'section' command while the rest of the arg should be the arguments to the section command. Its case insensitive.
Definition at line 286 of file ArConfig.cpp. References ArConfigSection::getName(), and ArLog::log(). |
|
for inheritors this is called after the file is processed For classes that inherit from ArConfig this function is called after parseFile and all of the processFileCBs are called... If you want to call something before the processFileCBs then just add a processFileCB... this is only called if there were no errors parsing the file or continueOnError was set to false when parseFile was called
Definition at line 88 of file ArConfig.h. Referenced by callProcessFileCallBacks(). |
|
Removes a processedFile callback. Removes a processFileCB, see addProcessFileCB for details Definition at line 996 of file ArConfig.cpp. References remProcessFileCB(). |
|
Removes a processedFile callback. Removes a processFileCB, see addProcessFileCB for details Definition at line 944 of file ArConfig.cpp. Referenced by remProcessFileCB(). |
|
Sets the comment for a section. This sets the comment on a section, if the section doesn't exist it is created. Definition at line 188 of file ArConfig.cpp. References findSection(), ArLog::log(), and ArConfigSection::setComment(). Referenced by ArRobotParams::ArRobotParams(). |
|
Uses this argument parser after it parses a file before it processes. This argument parser the arguments in to check for parameters of this name, note that ONLY the first parameter of this name will be used, so if you have duplicates only the first one will be set. Definition at line 1109 of file ArConfig.cpp. |
|
Write out a config file with defaults.
clear out our written ones between sections Definition at line 627 of file ArConfig.cpp. References ArArgumentBuilder::add(), ArArgumentBuilder::getArg(), ArArgumentBuilder::getArgc(), ArConfigArg::getArgsWithFunctor(), ArConfigArg::getBool(), ArConfigSection::getComment(), ArConfigArg::getConfigPriority(), ArConfigArg::getDescription(), ArConfigArg::getDouble(), ArConfigArg::getInt(), ArConfigArg::getMaxDouble(), ArConfigArg::getMaxInt(), ArConfigArg::getMinDouble(), ArConfigArg::getMinInt(), ArConfigArg::getName(), ArConfigSection::getName(), ArConfigSection::getParams(), ArConfigArg::getString(), ArConfigArg::getType(), and ArLog::log(). Referenced by ArRobotParams::save(). |