unique_storage< I, V > Class Template Reference

#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_valueid_map

Private Attributes

stored_values values
 the contained values
id_map ids
 map from ID to value

Detailed Description

template<typename I, typename V>
class unique_storage< I, V >

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.


Member Typedef Documentation

template<typename I, typename V>
typedef std::map<V, id_value> unique_storage< I, V >::id_map [private]

Definition at line 101 of file unique_storage.h.

template<typename I, typename V>
typedef std::vector<V> unique_storage< I, V >::stored_values

Definition at line 43 of file unique_storage.h.


Constructor & Destructor Documentation

template<typename I, typename V>
unique_storage< I, V >::unique_storage (  )  [inline]

Definition at line 36 of file unique_storage.h.

template<typename I, typename V>
virtual unique_storage< I, V >::~unique_storage (  )  [inline, virtual]

Definition at line 41 of file unique_storage.h.


Member Function Documentation

template<typename I, typename V>
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().

Here is the caller graph for this function:

template<typename I, typename V>
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.


Field Documentation

template<typename I, typename V>
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().

template<typename I, typename V>
stored_values unique_storage< I, V >::values [private]

The documentation for this class was generated from the following file:

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1