tlp::DataSet Class Reference
A container which can store data of any type, as long as it has a well-defined copy constructor.
More...
#include <Reflect.h>
List of all members.
Public Member Functions
- DataSet ()
- DataSet (const DataSet &set)
- DataSet & operator= (const DataSet &set)
- ~DataSet ()
- template<typename T > bool get (const std::string &key, T &value) const
- Returns the stored value associated with the given key. The stored value is a copy of the original value that was set. If there is no value associated with the given key, the input value is left untouched.
- template<typename T > bool getAndFree (const std::string &key, T &value)
- Returns the stored value, and deletes the stored copy. If no value is found, nothing is deleted.
- template<typename T > void set (const std::string &key, const T &value)
- Stores a copy of the given param, associated with the key. The value must have a well-formed copy constructor.
- void writeData (std::ostream &os, const std::string &prop, const DataType *dt) const
- bool readData (std::istream &is, const std::string &prop, const std::string &outputTypeName)
- bool exist (const std::string &str) const
- void remove (const std::string &str)
- DataType * getData (const std::string &str) const
- void setData (const std::string &str, const DataType *value)
- tlp::Iterator< std::pair
< std::string, DataType * > > * getValues () const
Static Public Member Functions
Detailed Description
A container which can store data of any type, as long as it has a well-defined copy constructor.
Constructor & Destructor Documentation
tlp::DataSet::DataSet |
( |
|
) |
[inline] |
tlp::DataSet::DataSet |
( |
const DataSet & |
set |
) |
|
tlp::DataSet::~DataSet |
( |
|
) |
|
Member Function Documentation
bool tlp::DataSet::exist |
( |
const std::string & |
str |
) |
const |
return true if str exists else false.
template<typename T >
bool tlp::DataSet::get |
( |
const std::string & |
key, |
|
|
T & |
value | |
|
) |
| | const [inline] |
Returns the stored value associated with the given key. The stored value is a copy of the original value that was set. If there is no value associated with the given key, the input value is left untouched.
- Parameters:
-
| key | The key with which the data we want to retrieve is associated. |
| value | A variable wich will be overwritten with the value to retrieve. |
- Returns:
- bool Whether there is a value associated with given key or not.
template<typename T >
bool tlp::DataSet::getAndFree |
( |
const std::string & |
key, |
|
|
T & |
value | |
|
) |
| | [inline] |
Returns the stored value, and deletes the stored copy. If no value is found, nothing is deleted.
Returns a copy of the value of the variable with name str. Type are checked in Debug Mode. If the variable str doesn't exist return false else true. The data is removed after the call.
- Parameters:
-
| key | The key with which the data we want to retrieve is associated. |
| value | A variable wich will be overwritten with the value to retrieve. |
- Returns:
- bool Whether there is a value associated with given key or not.
DataType* tlp::DataSet::getData |
( |
const std::string & |
str |
) |
const |
return an untyped value if any
Return an iterator on all values
static bool tlp::DataSet::read |
( |
std::istream & |
is, |
|
|
DataSet & |
ds | |
|
) |
| | [static] |
static version used for serialization
bool tlp::DataSet::readData |
( |
std::istream & |
is, |
|
|
const std::string & |
prop, |
|
|
const std::string & |
outputTypeName | |
|
) |
| | |
template<typename T >
static void tlp::DataSet::registerDataTypeSerializer |
( |
const DataTypeSerializer & |
serializer |
) |
[inline, static] |
register a serializer for a known type
void tlp::DataSet::remove |
( |
const std::string & |
str |
) |
|
template<typename T >
void tlp::DataSet::set |
( |
const std::string & |
key, |
|
|
const T & |
value | |
|
) |
| | [inline] |
Stores a copy of the given param, associated with the key. The value must have a well-formed copy constructor.
- Parameters:
-
| key | The key which can be used to retrieve the data. |
| value | The data to store. |
- Returns:
- void
void tlp::DataSet::setData |
( |
const std::string & |
str, |
|
|
const DataType * |
value | |
|
) |
| | |
set from an untyped value
static DataTypeSerializer* tlp::DataSet::typenameToSerializer |
( |
const std::string & |
name |
) |
[static] |
Return the data type serializer associated to the given typename. Returns NULL if no serializer is found
static void tlp::DataSet::write |
( |
std::ostream & |
os, |
|
|
const DataSet & |
ds | |
|
) |
| | [static] |
static version used for serialization
void tlp::DataSet::writeData |
( |
std::ostream & |
os, |
|
|
const std::string & |
prop, |
|
|
const DataType * |
dt | |
|
) |
| | const |