#include <unique_storage.h>
Data Structures | |
struct | id_value |
the actual ID type More... | |
Public Types | |
typedef std::vector< V > | stored_values |
Public Member Functions | |
unique_storage () | |
virtual | ~unique_storage () |
id_value const | create (V const &value) |
ensure this value is available | |
V const & | get (id_value const &id) const |
return the stored value for the given ID | |
Private Types | |
typedef std::map< V, id_value > | id_map |
Private Attributes | |
stored_values | values |
the contained values | |
id_map | ids |
map from ID to value |
Store values such that only one copy of the value is ever stored.
I is an arbitrary typename that's never used.
It is a required parameter in order to enforce type-safety for a collection.
The value type "V" must be default-constructible, and this is the value returned by a stored id_value where .set() is false
Definition at line 33 of file unique_storage.h.
typedef std::map<V, id_value> unique_storage< I, V >::id_map [private] |
Definition at line 101 of file unique_storage.h.
typedef std::vector<V> unique_storage< I, V >::stored_values |
Definition at line 43 of file unique_storage.h.
unique_storage< I, V >::unique_storage | ( | ) | [inline] |
Definition at line 36 of file unique_storage.h.
virtual unique_storage< I, V >::~unique_storage | ( | ) | [inline, virtual] |
Definition at line 41 of file unique_storage.h.
id_value const unique_storage< I, V >::create | ( | V const & | value | ) | [inline] |
ensure this value is available
Definition at line 80 of file unique_storage.h.
Referenced by profile_container::add_samples(), and arc_recorder::process_children().
V const& unique_storage< I, V >::get | ( | id_value const & | id | ) | const [inline] |
return the stored value for the given ID
Definition at line 92 of file unique_storage.h.
id_map unique_storage< I, V >::ids [private] |
map from ID to value
Definition at line 107 of file unique_storage.h.
Referenced by unique_storage< debug_name_tag, stored_name >::create().
stored_values unique_storage< I, V >::values [private] |
the contained values
Definition at line 104 of file unique_storage.h.
Referenced by unique_storage< debug_name_tag, stored_name >::create(), unique_storage< debug_name_tag, stored_name >::get(), and unique_storage< debug_name_tag, stored_name >::unique_storage().