#include <pointermap.h>
Inheritance diagram for PointerMap< T, K, owns_objects >:
By default, the objects are assumed to be allocated on the heap and their memory management is handled by the database; if instead you wish to manage the memory yourself (e.g. for objects existing in more than one map) supply false for the owns_objects template parameter.
Definition at line 29 of file pointermap.h.
Public Types | |
typedef PointerMap< T, K, owns_objects > | self |
Type of this class. | |
typedef K | key_type |
Key type of our local map. | |
typedef T * | data_type |
Data element type of our local map. | |
typedef std::pair< const key_type, data_type > | value_type |
Element type of our local map. | |
typedef std::map< key_type, data_type > | map_type |
Type of our local map. | |
typedef map_type::iterator | iterator |
Map's iterator. | |
typedef map_type::const_iterator | const_iterator |
Map's const_iterator. | |
typedef map_type::size_type | size_type |
Map's size_type. | |
Public Methods | |
PointerMap (const self &o) | |
Copy construction and assignment are unimplemented; implementing them wouldn't be particularly difficult but it would require assuming a clone operator for the datatype. | |
self & | operator= (const self &o) |
iterator | begin () |
Underlying map's begin(). | |
const_iterator | begin () const |
Underlying map's begin(). | |
iterator | end () |
Underlying map's end(). | |
const_iterator | end () const |
Underlying map's end(). | |
std::pair< iterator, bool > | insert (const value_type &x) |
Insert into underlying map. | |
void | set (const key_type &k, const data_type d) |
Instead of directly using the map's [], which has a tricky semantics, or find, which is cumbersome, map access is handled through named get and set member functions. | |
T * | getptr (const key_type &k) |
Similar to map's [], but if the key is not present just returns a null pointer without adding a new entry. | |
const T * | getptr (const key_type &k) const |
Const version of getptr. | |
void | erase () |
Remove all items from the map. | |
void | erase (const key_type &k) |
Remove the item with the given key, if any, from the map. | |
size_type | size () |
Size of the underlying map. | |
Protected Attributes | |
map_type | m |
Underlying container. |
|
Instead of directly using the map's [], which has a tricky semantics, or find, which is cumbersome, map access is handled through named get and set member functions. It is illegal to supply an invalid pointer to set, since this class will handle the deallocation of the object pointed to. Definition at line 80 of file pointermap.h. Referenced by HasTable< mat::MatrixInterface< Bounded::Magnitude > >::table_set(). |