DUNE: Uniform Navigational Environment
2.6.0-rc1
|
Microsoft Windows INI configuration file parser.
The configuration file format consists of sections, led by a "[section]" header and followed by "option = value" entries, with continuations in the style of RFC 822. Note that leading and trailing whitespaces are removed from values. Character case in "option" identifiers is discarded. Lines beginning with "#" or ";" are ignored and may be used to provide comments.
Public Member Functions | |
Config (void) | |
Config (const char *fname) | |
void | parseFile (const char *fname) |
void | set (const std::string §ion, const std::string &option, const std::string &value) |
std::string | get (const std::string §ion, const std::string &option) |
void | setSection (const std::string §ion, const std::map< std::string, std::string > &map) |
std::map< std::string, std::string > | getSection (const std::string §ion) |
template<typename Type > | |
void | get (const std::string &sec, const std::string &opt, const std::string &def, Type &var) |
template<typename T > | |
bool | getList (const std::string §ion, const std::string &option, T *dest, unsigned int size) |
void | writeToFile (const char *file) |
std::vector< std::string > | files (void) |
std::vector< std::string > | sections (void) |
std::vector< std::string > | options (const std::string §ion) |
Friends | |
DUNE_DLL_SYM std::ostream & | operator<< (std::ostream &os, const Config &cfg) |
|
inline |
Default constructor.
DUNE::Parsers::Config::Config | ( | const char * | fname | ) |
Create the parser and parse a configuration file.
fname | name of the configuration file to parse. |
References parseFile().
|
inline |
Retrieve the file option of the parsed configuration file.
|
inline |
Retrieve the value of an option in a given section.
section | section. |
option | option. |
Referenced by DUNE::Control::BasicAutopilot::BasicAutopilot(), DUNE::Daemon::consume(), DUNE::Daemon::Daemon(), DUNE::Tasks::Task::loadConfig(), DUNE::Tasks::Manager::Manager(), Simulators::Environment::Task::onResourceInitialization(), Sensors::MLBL::Task::onResourceInitialization(), DUNE::Parsers::PlanConfigParser::parse(), DUNE::Parsers::PlanConfigParser::parseActions(), DUNE::Parsers::PlanConfigParser::parseAngle(), DUNE::Parsers::PlanConfigParser::parseCoordinate(), DUNE::Parsers::PlanConfigParser::parseDuration(), DUNE::Parsers::PlanConfigParser::parseSpeed(), DUNE::Parsers::PlanConfigParser::parseTimeout(), DUNE::Parsers::PlanConfigParser::parseZ(), DUNE::Parsers::PlanConfigParser::parseZUnits(), DUNE::Control::PathController::PathController(), DUNE::Plans::PowerModel::PowerModel(), DUNE::Math::Matrix::readFromConfig(), DUNE::Plans::SpeedModel::SpeedModel(), Plan::Generator::Task::Task(), Monitors::FuelLevel::Task::Task(), Supervisors::AUV::Assist::Task::Task(), Monitors::Medium::Task::Task(), Control::AUV::Speed::Task::Task(), Monitors::OperationalLimits::Task::Task(), and Control::AUV::Attitude::Task::Task().
|
inline |
Retrieve the value of an option in a given section and perform type conversion.
sec | section. |
opt | option. |
def | default value. |
var | destination variable. |
References DUNE::castLexical(), and DUNE::Utils::String.
|
inline |
Retrieve the list of strings separated by commas of an option in a given section, performing type conversion.
section | section. |
option | option. |
dest | destination array. |
size | expected number of strings. |
|
inline |
Retrieve the option map of a given section.
[in] | section | section name. |
Referenced by DUNE::Tasks::Task::loadConfig().
std::vector< std::string > DUNE::Parsers::Config::options | ( | const std::string & | section | ) |
Retrieve all the options under the given section.
section | section of interest. |
Referenced by DUNE::Daemon::Daemon(), and DUNE::Parsers::PlanConfigParser::parseActions().
void DUNE::Parsers::Config::parseFile | ( | const char * | fname | ) |
Parse a configuration file.
fname | name of the configuration file to parse. |
References DUNE::System::Error::getLastMessage().
Referenced by Config(), and DUNE::Daemon::Daemon().
std::vector< std::string > DUNE::Parsers::Config::sections | ( | void | ) |
Retrieve all the available sections.
Referenced by DUNE::Tasks::Manager::Manager().
|
inline |
Set a configuration parameter.
section | section. |
option | option. |
value | value for option. |
Referenced by DUNE::Daemon::consume().
|
inline |
Set the option map of a given section.
[in] | section | section name. |
[in] | map | map of <option, value>. |
void DUNE::Parsers::Config::writeToFile | ( | const char * | file | ) |
Writes the current configuration to a file.
file | output file option. |
Referenced by DUNE::Daemon::consume().
|
friend |
Write the current configuration to a stream.
[in] | os | output stream. |
[in] | cfg | Config instance. |