|
Data | operator[] (const std::string &key) |
| Allows to assign new values to a entry with given key (NEW) More...
|
|
template<class T > |
std::vector< T > | collect (const std::vector< std::string > &keys) |
| convenience function that allows collecting data from different source entries More...
|
|
| MultiTypeMap () |
| Default constructor (create a new MultiTypeMap object) More...
|
|
| ~MultiTypeMap () |
| Destructor (deletes all remaining data) More...
|
|
template<class T > |
T * | allocArray (const std::string &id, unsigned int n) |
| Allocates a new memory block (new T[n]) for the given id string. More...
|
|
template<class T > |
T & | allocValue (const std::string &id, const T &val=T()) |
| Allocates a new memory elements (new T(val)) for the given id string. More...
|
|
template<class T > |
void | release (const std::string &id) |
| release the data element that is associated with the given id More...
|
|
template<class T > |
T * | getArray (const std::string &id, int *lenDst=0) |
| get a T* that is associated with the given id More...
|
|
template<class T > |
T & | getValue (const std::string &id, bool checkType=true) |
| get a T reference that is associated with the given id More...
|
|
template<class T > |
const T & | getValue (const std::string &id, bool checkType=true) const |
|
const std::string & | getType (const std::string &id) const |
| returns the RTTI string type identifier, for the entry associated with id More...
|
|
template<class T > |
bool | checkType (const std::string &id) const |
| checks if the type-id associated with the template parameter T is compatible to the entry for id More...
|
|
bool | isArray (const std::string &id) const |
| returns whether an entry is an array or a value More...
|
|
bool | contains (const std::string &id) const |
| returns whether a given value is already set More...
|
|
void | lock () const |
|
void | unlock () const |
| internally unlocks the data store More...
|
|
void | listContents () const |
| shows a list of currently contained data More...
|
|
void | clear () |
|
std::vector< Entry > | getEntryList () const |
| returns a list of all entries More...
|
|
Extension of the associative container MultiTypeMap.
Adds an index operator[string] for direct access to contained values
Data icl::qt::DataStore::operator[] |
( |
const std::string & |
key | ) |
|
Allows to assign new values to a entry with given key (NEW)
The returned Data-Element is a shallow Reference of a DataStore entry of internal type DataArray. Each entry is typed by C++'s RTTI, so, the function can determine if the assigned value is compatible to actual type of the data element. Internally a magic assignment system is used to determine whether two types can be assigned, and what to do if. Basically one can say, type assignments line T = T are of course allowed as well as type assignments A = B, if A and B are C++ built-in numerical type (int, float, etc.) Additionally a lot of GUIHandle types (contained by a GUI's DataStore) can be assigned (and updated, see void DataStore::Data::update()) with this mechanism
A detailed description of all allowed assigmnet must ba added here: TODO...
Here are some examples ...
DataStore x;
x.allocValue("hello",int(5));
x.allocValue("world",float(5));
x.allocValue("!",std::string("yes yes!"));
x["hello"] = "44";
x["world"] = 4;
x["!"] = 44;
x["hello"] = 44;
x.allocValue("image",ImgHandle(...));
x.allocValue("sl",SliderHandle(...));
x["sl"] = 7;
std::cout << "slider val is:" << x["sl"].as<int>() << std::endl;
x["sl"] = Range32s(3,9);