#include <Store.h>
Public Types | |
typedef registry_type::const_iterator | const_iterator |
typedef registry_type::iterator | iterator |
typedef K | key_type |
typedef N | name_type |
typedef I | pimpl_type |
typedef Rep_type * | prep_type |
typedef std::map< name_type, prep_type > | registry_type |
typedef rep_type< name_type, pimpl_type > | Rep_type |
typedef registry_type::size_type | size_type |
Public Member Functions | |
iterator | begin () |
const_iterator | begin () const |
void | clear () |
prep_type | create (const name_type &) |
prep_type | create (const name_type &, pimpl_type) |
const_iterator | end () const |
iterator | end () |
bool | isDefined (const name_type &n) const |
bool | readOnly () const |
void | setReadOnly (bool b) |
size_type | size () const |
Store () | |
void | swap (Store &) |
~Store () | |
Protected Member Functions | |
Store & | operator= (const Store &) |
Store (const Store &) | |
Protected Attributes | |
bool | readOnly_ |
registry_type | reg_ |
A Store provides a place for objects of type I which are uniquely identified by there name of type N. The objects themselves can be accessed indirectly by the prep_type of the Store like
typedef Store<std::string,double> NamedDouble; NamedDouble::prep_type d = NamedDouble("Four", new double(4.)); double val = *(d->second); std::string name = d->first;
K is the key_type which is used as an index in the storage. It must fulfill all requirements for a key in a sorted associative container. N is the user-friendly name_type, which must be mapped uniquely to the key_type and vice versa. N itself must also fulfill all requirements of a key in a sorted associative container. The reason to provide K is that one might save some memory by compacting common parts of information contained in different instances of N, e.g. if N is a pair<string,string>, the first string being a 'namespace' the second a 'name' then K could be a pair<int,string> thus compacting the namespace-string to a simple int. K and N must support following unique conversions:
typedef registry_type::const_iterator DDI::Store< N, I, K >::const_iterator |
typedef registry_type::iterator DDI::Store< N, I, K >::iterator |
typedef K DDI::Store< N, I, K >::key_type |
typedef N DDI::Store< N, I, K >::name_type |
typedef I DDI::Store< N, I, K >::pimpl_type |
typedef Rep_type* DDI::Store< N, I, K >::prep_type |
typedef std::map<name_type,prep_type> DDI::Store< N, I, K >::registry_type |
typedef rep_type<name_type, pimpl_type> DDI::Store< N, I, K >::Rep_type |
typedef registry_type::size_type DDI::Store< N, I, K >::size_type |
DDI::Store< N, I, K >::Store | ( | ) | [inline] |
DDI::Store< N, I, K >::~Store | ( | ) |
DDI::Store< N, I, K >::Store | ( | const Store< N, I, K > & | ) | [protected] |
iterator DDI::Store< N, I, K >::begin | ( | void | ) | [inline] |
const_iterator DDI::Store< N, I, K >::begin | ( | void | ) | const [inline] |
void DDI::Store< N, I, K >::clear | ( | ) |
Store< N, I, K >::prep_type DDI::Store< N, I, K >::create | ( | const name_type & | n | ) |
Definition at line 121 of file Store.h.
References Exception, Exhume::I, query::result, and tmp.
{ prep_type tmp = 0; std::pair<typename registry_type::iterator,bool> result = reg_.insert(std::make_pair(n,tmp)); if (result.second) { if (readOnly_) throw cms::Exception("DetectorDescriptionStore")<<" Store has been locked. Illegal attempt to add " << n << " to a global store."; // ELSE result.first->second = new Rep_type(n,(I)0); } return result.first->second; }
Store< N, I, K >::prep_type DDI::Store< N, I, K >::create | ( | const name_type & | n, |
pimpl_type | p | ||
) |
Definition at line 137 of file Store.h.
References Exception, AlCaHLTBitMon_ParallelJobs::p, query::result, and tmp.
{ if (readOnly_) throw cms::Exception("DetectorDescriptionStore")<<" Store has been locked. Illegal attempt to add " << n << " to a global store."; // ELSE prep_type tmp = 0; std::pair<typename registry_type::iterator,bool> result = reg_.insert(std::make_pair(n,tmp)); if (!result.second) { delete result.first->second->second; result.first->second->second = p; //delete result.first->second->swap(p); } else { result.first->second = new Rep_type(n,p); } return result.first->second; }
const_iterator DDI::Store< N, I, K >::end | ( | void | ) | const [inline] |
iterator DDI::Store< N, I, K >::end | ( | void | ) | [inline] |
bool DDI::Store< N, I, K >::isDefined | ( | const name_type & | n | ) | const |
Definition at line 176 of file Store.h.
References query::result.
Store& DDI::Store< N, I, K >::operator= | ( | const Store< N, I, K > & | ) | [protected] |
bool DDI::Store< N, I, K >::readOnly | ( | ) | const [inline] |
void DDI::Store< N, I, K >::setReadOnly | ( | bool | b | ) | [inline] |
size_type DDI::Store< N, I, K >::size | ( | void | ) | const [inline] |
void DDI::Store< N, I, K >::swap | ( | Store< N, I, K > & | storeToSwap | ) |
Definition at line 190 of file Store.h.
References DDI::Store< N, I, K >::readOnly_, and DDI::Store< N, I, K >::reg_.
bool DDI::Store< N, I, K >::readOnly_ [protected] |
Definition at line 95 of file Store.h.
Referenced by DDI::Store< DDName, DDRotationMatrix * >::readOnly(), DDI::Store< DDName, DDRotationMatrix * >::setReadOnly(), and DDI::Store< N, I, K >::swap().
registry_type DDI::Store< N, I, K >::reg_ [protected] |
Definition at line 92 of file Store.h.
Referenced by DDI::Store< DDName, DDRotationMatrix * >::begin(), DDI::Store< DDName, DDRotationMatrix * >::end(), DDI::Store< DDName, DDRotationMatrix * >::size(), and DDI::Store< N, I, K >::swap().