ObjectStore< T > Class Template Reference
This is a template class for storing key-value-pairs. More...
#include <ObjectStore.h>
Public Member Functions | |
| bool | put (const char *key, T *value) |
| T * | get (const char *key) |
| void | remove (const char *key, void(*method)(T *)) |
| void | removeAll (void(*method)(T *)) |
Static Public Member Functions | |
| static void | _deleteAlsoContent_ (T *value) |
Private Attributes | |
| std::map< std::string, T * > | store |
Detailed Description
template<typename T>
class ObjectStore< T >
This is a template class for storing key-value-pairs.
This class stores key-value-pairs. The type of the keys is always the STL string-type. The type of the values can be set through the template instantiation.
This class excepts only key-value-pairs with unique keys. Duplicate key-value-pairs will be ignored.
This class offers methods for storing and retrieving key-value-pairs. There are also special methods for deleting key-value-pairs. A method-pointer can be used, to call a method before the deletion-process begins.
- Date:
- 23rd of March 2007
Member Function Documentation
| static void ObjectStore< T >::_deleteAlsoContent_ | ( | T * | value | ) | [inline, static] |
This method deletes the value of a key-value-pair.
- Parameters:
-
value The value to which this pointer points, will be deleted.
| T* ObjectStore< T >::get | ( | const char * | key | ) | [inline] |
This method retrieves a value from the store with the fitting key.
- Parameters:
-
key This is the key of the needed key-value-pair.
- Returns:
- the value or NULL if the needed key-value-pair doesn't exist in the store
| bool ObjectStore< T >::put | ( | const char * | key, | |
| T * | value | |||
| ) | [inline] |
This method puts a key-value-object into the store.
- Parameters:
-
key the key value the value
- Returns:
- true on success, false in any other cases
| void ObjectStore< T >::remove | ( | const char * | key, | |
| void(*)(T *) | method | |||
| ) | [inline] |
This method removes an item from the store. But first the parameter method will be invoked.
- Parameters:
-
key This is the key of the key-value-pair, which should be removed. method This method will be invoked. If no method is needed, use NULL.
| void ObjectStore< T >::removeAll | ( | void(*)(T *) | method | ) | [inline] |
This method removes all items in the store. But first the parameter method will be invoked.
- Parameters:
-
method This method will be invoked first. If no method is needed, use NULL.
Member Data Documentation
std::map<std::string, T*> ObjectStore< T >::store [private] |
The documentation for this class was generated from the following file:
- tools/libraries/3DMenu/core/ObjectStore.h
Generated on Wed Oct 20 16:11:58 2010 for inVRs by
1.5.8