|
orca-robotics
INTRODUCTION
Overview
Download and Install
Documentation
REPOSITORY
Interfaces
Drivers
Libraries
Utilities
Software Map
DEVELOPER
Dashboard
PEOPLE
Contributors
Users
Project
Download
Mailing lists
|
|
|
hydroutil::Properties Class ReferenceContainer for key-value pairs, useful for storing configuration properties.
More...
#include <properties.h>
List of all members.
|
Public Member Functions |
| Properties (const Config &config=Config()) |
| Constructor.
|
| Properties (const std::map< std::string, std::string > &props, const std::string &removePrefix="", const Config &config=Config()) |
bool | isDefined (const ::std::string &key) |
| Returns TRUE if the property with key is defined (event if it's empty) and FALSE if it is not defined.
|
int | getProperty (const ::std::string &key, std::string &value) const |
| Returns: 0 = property found (and set in value), non-zero = property not found.
|
std::string | getPropertyWithDefault (const ::std::string &key, const std::string &defaultValue) const |
| Returns the default value if key is not found.
|
int | getPropertyAsDouble (const ::std::string &key, double &value) const |
double | getPropertyAsDoubleWithDefault (const ::std::string &key, const double defaultValue) const |
int | getPropertyAsDoubleVector (const ::std::string &key, std::vector< double > &value) const |
std::vector< double > | getPropertyAsDoubleVectorWithDefault (const ::std::string &key, const std::vector< double > &defaultValue) const |
int | getPropertyAsInt (const ::std::string &key, int &value) const |
int | getPropertyAsIntWithDefault (const ::std::string &key, const int defaultValue) const |
int | getPropertyAsIntVector (const ::std::string &key, std::vector< int > &value) const |
std::vector< int > | getPropertyAsIntVectorWithDefault (const ::std::string &key, const std::vector< int > &defaultValue) const |
void | setProperty (const ::std::string &key, const ::std::string &value) |
| Sets property.
|
const std::map< std::string,
std::string > & | data () const |
| Returns const reference to the property map.
|
size_t | size () const |
| Returns number of properties in the set.
|
std::string | toString () const |
| Returns all properties in format "key=value" per line.
|
Static Public Member Functions |
static std::string | missingPropertyWarning (const std::string &prop, bool fatal=false) |
Classes |
struct | Config |
| Configuration structure for Properties. More...
|
Detailed Description
Container for key-value pairs, useful for storing configuration properties.
Not thead-safe.
Constructor & Destructor Documentation
hydroutil::Properties::Properties |
( |
const std::map< std::string, std::string > & |
props, |
|
|
const std::string & |
removePrefix = "" , |
|
|
const Config & |
config = Config() |
|
) |
|
|
|
Copy constructor. If removePrefix is not empty, it is assumed that all keys in props start with the same prefix and it is removed. This is a common situation when props is the output of Ice::Properties::getPropertiesForPrefix() function. If a particular key does not have the specified prefix, it is quietly added unmodified. |
Member Function Documentation
int hydroutil::Properties::getPropertyAsDouble |
( |
const ::std::string & |
key, |
|
|
double & |
value |
|
) |
const |
|
|
Returns: 0 = property found (and set in value), non-zero = property not found. Throws an gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
int Properties::getPropertyAsDoubleVector |
( |
const ::std::string & |
key, |
|
|
std::vector< double > & |
value |
|
) |
const |
|
|
Parses the value into a vector of doubles assuming empty space delimeters. Elements will continue to be added to the end of the vector until the end of the line is reached. Returns: 0 = property found (and set in value), non-zero = property not found. Throws an gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
std::vector< double > Properties::getPropertyAsDoubleVectorWithDefault |
( |
const ::std::string & |
key, |
|
|
const std::vector< double > & |
defaultValue |
|
) |
const |
|
|
Returns the default value if key is not found. Throws an gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
double hydroutil::Properties::getPropertyAsDoubleWithDefault |
( |
const ::std::string & |
key, |
|
|
const double |
defaultValue |
|
) |
const |
|
|
Returns the default value if key is not found. Throws an gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
int hydroutil::Properties::getPropertyAsInt |
( |
const ::std::string & |
key, |
|
|
int & |
value |
|
) |
const |
|
|
Returns: 0 = property found (and set in value), non-zero = property not found. Throws an gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
int Properties::getPropertyAsIntVector |
( |
const ::std::string & |
key, |
|
|
std::vector< int > & |
value |
|
) |
const |
|
|
Parses the value into a vector of ints assuming empty space delimeters. Elements will continue to be added to the end of the vector until the end of the line is reached. Returns: 0 = property found (and set in value), non-zero = property not found. Throws an gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
std::vector< int > Properties::getPropertyAsIntVectorWithDefault |
( |
const ::std::string & |
key, |
|
|
const std::vector< int > & |
defaultValue |
|
) |
const |
|
|
Returns the default value if key is not found. Throws an gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
int hydroutil::Properties::getPropertyAsIntWithDefault |
( |
const ::std::string & |
key, |
|
|
const int |
defaultValue |
|
) |
const |
|
|
Returns the default value if key is not found. Throws an gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
std::string Properties::missingPropertyWarning |
( |
const std::string & |
prop, |
|
|
bool |
fatal = false |
|
) |
[static] |
|
|
Returns standardized text which warns that a configuration property is not set. If fatal is TRUE, the message says "that operation cannot continue". |
The documentation for this class was generated from the following files:
|
|