#include <DetectorDescription/Base/interface/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 | |
const_iterator | begin () const |
iterator | begin () |
void | clear () |
prep_type | create (pimpl_type) |
prep_type | create (const name_type &, pimpl_type) |
prep_type | create (const name_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 () | |
~Store () | |
Protected Member Functions | |
Store & | operator= (const Store &) |
Store (const Store &) | |
Protected Attributes | |
bool | readOnly_ |
registry_type | reg_ |
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-fristdendly name_type, which must be std::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<std::string,std::string>, the first std::string being a 'namespace' the second a 'name' then K could be a pair<int,std::string> thus compacting the namespace-stdstring to a simple int. K and N must support following unique conversions:
Definition at line 37 of file Store.h.
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 | ( | ) | [inline] |
Definition at line 158 of file Store.h.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), it, and DDI::Store< N, I, K >::reg_.
00159 { 00160 typename registry_type::iterator it = reg_.begin(); 00161 for(; it != reg_.end(); ++it) { 00162 std::cout << "deleting " << it->first << std::endl; 00163 delete it->second->second; it->second->second = 0; 00164 delete it->second; it->second = 0; 00165 } 00166 }
DDI::Store< N, I, K >::Store | ( | const Store< N, I, K > & | ) | [protected] |
const_iterator DDI::Store< N, I, K >::begin | ( | ) | const [inline] |
iterator DDI::Store< N, I, K >::begin | ( | ) | [inline] |
void DDI::Store< N, I, K >::clear | ( | void | ) | [inline] |
prep_type DDI::Store< N, I, K >::create | ( | pimpl_type | ) |
Store< N, I, K >::prep_type DDI::Store< N, I, K >::create | ( | const name_type & | n, | |
pimpl_type | p | |||
) | [inline] |
Definition at line 131 of file Store.h.
References DDI::Store< N, I, K >::reg_, HLT_VtxMuL3::result, and tmp.
00133 { 00134 prep_type tmp = 0; 00135 std::pair<typename registry_type::iterator,bool> result 00136 = reg_.insert(std::make_pair(n,tmp)); 00137 if (!result.second) { 00138 delete result.first->second->second; 00139 result.first->second->second = p; 00140 //delete result.first->second->swap(p); 00141 } 00142 else { 00143 result.first->second = new Rep_type(n,p); 00144 } 00145 return result.first->second; 00146 }
Store< N, I, K >::prep_type DDI::Store< N, I, K >::create | ( | const name_type & | n | ) | [inline] |
Definition at line 117 of file Store.h.
References I, DDI::Store< N, I, K >::reg_, HLT_VtxMuL3::result, and tmp.
00118 { 00119 prep_type tmp = 0; 00120 std::pair<typename registry_type::iterator,bool> result 00121 = reg_.insert(std::make_pair(n,tmp)); 00122 if (result.second) { 00123 result.first->second = new Rep_type(n,(I)0); 00124 } 00125 return result.first->second; 00126 }
const_iterator DDI::Store< N, I, K >::end | ( | ) | const [inline] |
iterator DDI::Store< N, I, K >::end | ( | ) | [inline] |
bool DDI::Store< N, I, K >::isDefined | ( | const name_type & | n | ) | const [inline] |
Definition at line 169 of file Store.h.
References it, DDI::Store< N, I, K >::reg_, and HLT_VtxMuL3::result.
00170 { 00171 typename registry_type::const_iterator it = reg_.find(n); 00172 bool result(false); 00173 if (it != reg_.end()) { 00174 if (it->second->second) { 00175 result=true; 00176 } 00177 } 00178 return result; 00179 }
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] |
bool DDI::Store< N, I, K >::readOnly_ [protected] |
Definition at line 91 of file Store.h.
Referenced by DDI::Store< N, C >::readOnly(), and DDI::Store< N, C >::setReadOnly().
registry_type DDI::Store< N, I, K >::reg_ [protected] |
Definition at line 90 of file Store.h.
Referenced by DDI::Store< N, C >::begin(), DDI::Store< N, I, K >::clear(), DDI::Store< N, I, K >::create(), DDI::Store< N, C >::end(), DDI::Store< N, I, K >::isDefined(), DDI::Store< N, C >::size(), and DDI::Store< N, I, K >::~Store().