Tulip
5.7.4
Large graphs analysis and drawing
|
#include <DataSet.h>
Public Member Functions | |
DataSet (const DataSet &set) | |
bool | empty () const |
bool | exists (const std::string &str) const |
template<typename T > | |
bool | get (const std::string &key, T &value) const |
template<typename T > | |
bool | getAndFree (const std::string &key, T &value) |
DataType * | getData (const std::string &str) const |
template<typename T > | |
bool | getDeprecated (const std::string &key, const std::string &oldKey, T &value) const |
template<typename T > | |
std::string | getTypeName () const |
std::string | getTypeName (const std::string &str) const |
tlp::Iterator< std::pair< std::string, DataType * > > * | getValues () const |
DataSet & | operator= (const DataSet &set) |
bool | readData (std::istream &is, const std::string &prop, const std::string &outputTypeName) |
void | remove (const std::string &str) |
template<typename T > | |
void | set (const std::string &key, const T &value) |
void | setData (const std::string &str, const DataType *value) |
template<typename T > | |
void | setDeprecated (const std::string &key, const std::string &deprecatedKey, const T &value) |
unsigned int | size () const |
std::string | toString () const |
void | writeData (std::ostream &os, const std::string &prop, const DataType *dt) const |
Static Public Member Functions | |
static bool | read (std::istream &is, DataSet &ds) |
template<typename T > | |
static void | registerDataTypeSerializer (const DataTypeSerializer &serializer) |
static DataTypeSerializer * | typenameToSerializer (const std::string &name) |
static void | write (std::ostream &os, const DataSet &ds) |
A container that can store data from any type.
The DataSet aggregate data of various types into a single structure and map each value to a key (std::string) describing its name. DataSet is mainly used in plugins. When creating a plugin, one can add input parameters (using tlp::WithParameter methods) and retrieve them from the dataSet member variable once they have been set by the user.
bool tlp::DataSet::empty | ( | ) | const |
Indicates whether the set is empty of not.
bool tlp::DataSet::exists | ( | const std::string & | str | ) | const |
str | the name of the member to look for |
bool tlp::DataSet::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.
key | The key with which the data we want to retrieve is associated. |
value | A variable which will be overwritten with the value to retrieve. |
Definition at line 23 of file DataSet.cxx.
bool tlp::DataSet::getAndFree | ( | const std::string & | key, |
T & | value | ||
) |
Returns the stored value, and deletes the stored copy. If no value is found, nothing is deleted.
key | The key with which the data we want to retrieve is associated. |
value | A variable which will be overwritten with the value to retrieve. |
Definition at line 62 of file DataSet.cxx.
DataType* tlp::DataSet::getData | ( | const std::string & | str | ) | const |
str | The name of the element to retrieve |
bool tlp::DataSet::getDeprecated | ( | const std::string & | key, |
const std::string & | oldKey, | ||
T & | value | ||
) | const |
Returns the stored value associated with the given key or the deprecated version of the key The stored value is a copy of the original value that was set. If there is no value associated with both keys, the input value is left untouched.
key | The key with which the data we want to retrieve is associated. |
oldKey | The deprecated version of the key. |
value | A variable which will be overwritten with the value to retrieve. |
Definition at line 38 of file DataSet.cxx.
|
inline |
std::string tlp::DataSet::getTypeName | ( | const std::string & | str | ) | const |
str | the name of the member to look for |
tlp::Iterator<std::pair<std::string, DataType *> >* tlp::DataSet::getValues | ( | ) | const |
Performs a deep copy of a DataSet into another.
|
static |
Reads a stream and stores its contents into a DataSet.
bool tlp::DataSet::readData | ( | std::istream & | is, |
const std::string & | prop, | ||
const std::string & | outputTypeName | ||
) |
Read a value and stores it into the specified type.
|
inlinestatic |
void tlp::DataSet::remove | ( | const std::string & | str | ) |
Removes an element from the DataSet.
str | the name of the element to remove |
void tlp::DataSet::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.
key | The key which can be used to retrieve the data. |
value | The data to store. |
Definition at line 79 of file DataSet.cxx.
void tlp::DataSet::setData | ( | const std::string & | str, |
const DataType * | value | ||
) |
Set from an untyped value.
void tlp::DataSet::setDeprecated | ( | const std::string & | key, |
const std::string & | deprecatedKey, | ||
const T & | value | ||
) |
Stores a copy of the given param, associated with a key and a deprected version of the key The value must have a well-formed copy constructor.
key | The key which can be used to retrieve the data. |
oldKey | The deprecated version of the key. |
value | The data to store. |
Definition at line 85 of file DataSet.cxx.
unsigned int tlp::DataSet::size | ( | ) | const |
Returns the number of registered values.
std::string tlp::DataSet::toString | ( | ) | const |
|
static |
|
static |
Serializes a DataSet into a stream.
void tlp::DataSet::writeData | ( | std::ostream & | os, |
const std::string & | prop, | ||
const DataType * | dt | ||
) | const |
write an embedded value