Tulip
5.2.1
Large graphs analysis and drawing
|
#include <DataSet.h>
Public Member Functions | |
DataSet (const DataSet &set) | |
bool | empty () const |
bool | exist (const std::string &str) 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 > | |
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) |
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.
|
inline |
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 wich 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 wich will be overwritten with the value to retrieve. |
Definition at line 38 of file DataSet.cxx.
DataType* tlp::DataSet::getData | ( | const std::string & | str | ) | const |
str | The name of the element to retrieve |
|
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 55 of file DataSet.cxx.
void tlp::DataSet::setData | ( | const std::string & | str, |
const DataType * | value | ||
) |
Set from an untyped value.
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