ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
CaloClusterMomentStore Class Reference

Stores CaloClusterMoment in a keyed map. More...

#include <CaloClusterMomentStore.h>

Collaboration diagram for CaloClusterMomentStore:

Classes

class  CaloClusterMomentIterator
 Internally used iterator. More...
 

Public Types

typedef CaloClusterMoment moment_value
 Moment data. More...
 
typedef CaloClusterMoment::MomentType moment_type
 Moment type. More...
 
typedef int moment_key
 Moment key type. More...
 
typedef std::map< moment_key, moment_valuemoment_store
 Internal moment store type. More...
 
typedef moment_store::const_iterator moment_store_const_iter
 Internal moment store const iterator type. More...
 
typedef moment_store::iterator moment_store_iter
 Internal moment store iterator type. More...
 
typedef std::vector< moment_typemoment_type_list
 List of moment types. More...
 
typedef CaloClusterMomentIterator moment_iterator
 External moment iterator type. More...
 

Public Member Functions

 CaloClusterMomentStore ()
 Default constructor. More...
 
 CaloClusterMomentStore (const CaloClusterMomentStore &rMomStore)
 Copy constructor. More...
 
 CaloClusterMomentStore (const CaloClusterMomentStore *pMomStore)
 
CaloClusterMomentStoreoperator= (const CaloClusterMomentStore &rMomStore)
 Assignment. More...
 
virtual ~CaloClusterMomentStore ()
 Default destructor. More...
 
virtual void insert (const moment_type &rMomType, const moment_value &rMomData)
 Insert key/data pair. More...
 
virtual bool retrieve (const moment_type &rMomType, moment_value &rMomData) const
 Retrieve cluster moment for a given key. More...
 
virtual bool retrieve (const moment_iterator &rMomIter, moment_value &rMomData) const
 Retrieve cluster moment for a given key. More...
 
virtual bool retrieveMomentTypes (moment_type_list &rMomTypeList) const
 Retrieve list of moment types in store. More...
 
virtual moment_iterator begin () const
 { More...
 
virtual moment_iterator end () const
 iterator loop terminator More...
 
virtual moment_iterator find (const moment_type &rMomType) const
 } More...
 
virtual bool contains (const moment_type &rMomType) const
 Containment check. More...
 
size_t size () const
 Number of stored moments. More...
 
virtual const moment_storemomentStore () const
 Access to internal store. More...
 
virtual void setMomentStore (const moment_store &rMomStore)
 Set internal store. More...
 
virtual void setMomentStore (moment_store &&rMomStore)
 

Private Attributes

moment_store m_store
 

Detailed Description

Stores CaloClusterMoment in a keyed map.

Definition at line 14 of file CaloClusterMomentStore.h.

Member Typedef Documentation

◆ moment_iterator

External moment iterator type.

Definition at line 137 of file CaloClusterMomentStore.h.

◆ moment_key

Moment key type.

Definition at line 33 of file CaloClusterMomentStore.h.

◆ moment_store

Internal moment store type.

Definition at line 35 of file CaloClusterMomentStore.h.

◆ moment_store_const_iter

typedef moment_store::const_iterator CaloClusterMomentStore::moment_store_const_iter

Internal moment store const iterator type.

Definition at line 37 of file CaloClusterMomentStore.h.

◆ moment_store_iter

typedef moment_store::iterator CaloClusterMomentStore::moment_store_iter

Internal moment store iterator type.

Definition at line 39 of file CaloClusterMomentStore.h.

◆ moment_type

Moment type.

Definition at line 31 of file CaloClusterMomentStore.h.

◆ moment_type_list

List of moment types.

Definition at line 41 of file CaloClusterMomentStore.h.

◆ moment_value

Moment data.

Definition at line 29 of file CaloClusterMomentStore.h.

Constructor & Destructor Documentation

◆ CaloClusterMomentStore() [1/3]

CaloClusterMomentStore::CaloClusterMomentStore ( )

Default constructor.

Definition at line 9 of file CaloClusterMomentStore.cxx.

10 { }

◆ CaloClusterMomentStore() [2/3]

CaloClusterMomentStore::CaloClusterMomentStore ( const CaloClusterMomentStore rMomStore)
explicit

Copy constructor.

Definition at line 12 of file CaloClusterMomentStore.cxx.

14  : m_store (rMomStore.m_store)
15 {
16 }

◆ CaloClusterMomentStore() [3/3]

CaloClusterMomentStore::CaloClusterMomentStore ( const CaloClusterMomentStore pMomStore)
explicit

Definition at line 18 of file CaloClusterMomentStore.cxx.

20  : m_store (pMomStore->m_store)
21 {
22 }

◆ ~CaloClusterMomentStore()

CaloClusterMomentStore::~CaloClusterMomentStore ( )
virtual

Default destructor.

Definition at line 33 of file CaloClusterMomentStore.cxx.

34 { }

Member Function Documentation

◆ begin()

CaloClusterMomentStore::moment_iterator CaloClusterMomentStore::begin ( ) const
inlinevirtual

{

Iterator access to moment store starting iterator

Definition at line 220 of file CaloClusterMomentStore.h.

221 {
222  return moment_iterator(m_store.begin());
223 }

◆ contains()

bool CaloClusterMomentStore::contains ( const moment_type rMomType) const
inlinevirtual

Containment check.

Parameters
rMomTypereference to non-modifiable moment type

Definition at line 237 of file CaloClusterMomentStore.h.

238 {
239  return m_store.find((moment_key)rMomType) != m_store.end();
240 }

◆ end()

CaloClusterMomentStore::moment_iterator CaloClusterMomentStore::end ( ) const
inlinevirtual

iterator loop terminator

Definition at line 226 of file CaloClusterMomentStore.h.

227 {
228  return moment_iterator(m_store.end());
229 }

◆ find()

CaloClusterMomentStore::moment_iterator CaloClusterMomentStore::find ( const moment_type rMomType) const
inlinevirtual

}

Find moment type

Parameters
rMomTypereference to non-modifiable moment type

Implementation is similar to STL method.

Definition at line 232 of file CaloClusterMomentStore.h.

233 {
234  return moment_iterator(m_store.find((moment_key)rMomType));
235 }

◆ insert()

void CaloClusterMomentStore::insert ( const moment_type rMomType,
const moment_value rMomData 
)
inlinevirtual

Insert key/data pair.

Parameters
rMomTypereference to moment type (non-modifiable)
rMomDatareference to moment data (non-modifiable)

Definition at line 213 of file CaloClusterMomentStore.h.

215 {
216  (*(m_store.insert(moment_store::value_type((moment_key)rMomType,rMomData))).first).second = rMomData;
217 }

◆ momentStore()

const CaloClusterMomentStore::moment_store & CaloClusterMomentStore::momentStore ( ) const
inlinevirtual

Access to internal store.

Attention
Historic, depreciated.

Definition at line 248 of file CaloClusterMomentStore.h.

249 {
250  return m_store;
251 }

◆ operator=()

CaloClusterMomentStore & CaloClusterMomentStore::operator= ( const CaloClusterMomentStore rMomStore)

Assignment.

Definition at line 25 of file CaloClusterMomentStore.cxx.

26 {
27  if (this != &rMomStore)
28  m_store = rMomStore.m_store;
29  return *this;
30 }

◆ retrieve() [1/2]

bool CaloClusterMomentStore::retrieve ( const moment_iterator rMomIter,
moment_value rMomData 
) const
virtual

Retrieve cluster moment for a given key.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
rMomIterreference to moment iterator (non-modifiable)
rMomDatareference to moment data (modifiable object)

Returns true if moment for given key can be retrieved. The data word is not modified if the moment type can not be found.

Definition at line 43 of file CaloClusterMomentStore.cxx.

45 {
46  if ( rMomIter != this->end() )
47  {
48  rMomData = rMomIter.getMoment();
49  return true;
50  }
51  else
52  {
53  return false;
54  }
55 }

◆ retrieve() [2/2]

bool CaloClusterMomentStore::retrieve ( const moment_type rMomType,
moment_value rMomData 
) const
virtual

Retrieve cluster moment for a given key.

Parameters
rMomTypereference to moment type (non-modifiable)
rMomDatareference to moment data (modifiable object)

Returns true if moment for given key can be retrieved. The data word is not modified if the moment type can not be found.

Definition at line 37 of file CaloClusterMomentStore.cxx.

39 {
40  moment_iterator fIter = this->find(rMomType);
41  return this->retrieve(fIter,rMomData);
42 }

◆ retrieveMomentTypes()

bool CaloClusterMomentStore::retrieveMomentTypes ( moment_type_list rMomTypeList) const
virtual

Retrieve list of moment types in store.

Parameters
rMomTypeListreference to modifiable list of moment types

Returns true if any moment types stored.

Definition at line 58 of file CaloClusterMomentStore.cxx.

60 {
61  size_t oldSize = rMomList.size();
62  moment_store_const_iter fMom = m_store.begin();
63  moment_store_const_iter lMom = m_store.end();
64  for ( ; fMom != lMom; ++fMom )
65  {
66  rMomList.push_back((moment_type)(*fMom).first);
67  }
68  return oldSize < rMomList.size();
69 }

◆ setMomentStore() [1/2]

void CaloClusterMomentStore::setMomentStore ( const moment_store rMomStore)
inlinevirtual

Set internal store.

Parameters
rMomStorereference to (non-modifiable) moment store
Attention
Support for historic interface, depreciated.

Definition at line 253 of file CaloClusterMomentStore.h.

255 {
256  m_store = rMomStore;
257 }

◆ setMomentStore() [2/2]

void CaloClusterMomentStore::setMomentStore ( moment_store &&  rMomStore)
inlinevirtual

Definition at line 258 of file CaloClusterMomentStore.h.

260 {
261  m_store = std::move(rMomStore);
262 }

◆ size()

size_t CaloClusterMomentStore::size ( ) const
inline

Number of stored moments.

Definition at line 242 of file CaloClusterMomentStore.h.

243 {
244  return m_store.size();
245 }

Member Data Documentation

◆ m_store

moment_store CaloClusterMomentStore::m_store
private

Definition at line 210 of file CaloClusterMomentStore.h.


The documentation for this class was generated from the following files:
CaloClusterMomentStore::moment_type
CaloClusterMoment::MomentType moment_type
Moment type.
Definition: CaloClusterMomentStore.h:31
CaloClusterMomentStore::moment_store_const_iter
moment_store::const_iterator moment_store_const_iter
Internal moment store const iterator type.
Definition: CaloClusterMomentStore.h:37
CaloClusterMomentStore::moment_iterator
CaloClusterMomentIterator moment_iterator
External moment iterator type.
Definition: CaloClusterMomentStore.h:137
CaloClusterMomentStore::find
virtual moment_iterator find(const moment_type &rMomType) const
}
Definition: CaloClusterMomentStore.h:232
CaloClusterMomentStore::moment_key
int moment_key
Moment key type.
Definition: CaloClusterMomentStore.h:33
CaloClusterMomentStore::m_store
moment_store m_store
Definition: CaloClusterMomentStore.h:210
CaloClusterMomentStore::retrieve
virtual bool retrieve(const moment_type &rMomType, moment_value &rMomData) const
Retrieve cluster moment for a given key.
Definition: CaloClusterMomentStore.cxx:37
CaloClusterMomentStore::end
virtual moment_iterator end() const
iterator loop terminator
Definition: CaloClusterMomentStore.h:226
DeMoScan.first
bool first
Definition: DeMoScan.py:534