List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Private Types | Private Attributes
det::ComponentGroup< P, C, Creator, ManagerProvider > Class Template Reference

Base class for group of detector components. More...

#include "det/ComponentGroup.h"

Classes

struct  InternalConstFunctor
 Const functor to convert id to Counter. More...
 
struct  InternalFunctor
 Functor to convert id to Counter. More...
 

Public Types

typedef C ComponentType
 The type of the contained component. More...
 
typedef
boost::transform_iterator
< InternalConstFunctor,
IdIterator, const C & > 
ConstIterator
 Convenience alias for constant iterators over components. More...
 
typedef
boost::transform_iterator
< InternalFunctor, IdIterator,
C & > 
Iterator
 Convenience alias for iterators over components. More...
 
typedef IdList::size_type SizeType
 Type for number of components. More...
 

Public Member Functions

Iterator Begin ()
 Begin iterator over components. More...
 
 ComponentGroup (const P &p)
 Construct with parent. More...
 
Iterator End ()
 End iterator over components. More...
 
bool Exists (int i) const
 Check for existence by id. More...
 
const C & Get (int i) const
 Retrieve component by id. More...
 
C & Get (int i)
 Retrieve component by id. More...
 
SizeType GetNumberOfComponents () const
 Returns the number of components. More...
 
void Update (const VManager::IndexMap &m, const bool invalidateData=true, const bool invalidateComponents=true)
 Updates the components. More...
 

Public Attributes

ConstIterator const
 Begin iterator over components. More...
 

Private Types

typedef boost::ptr_map< int, C > ComponentMap
 
typedef
ComponentMap::const_iterator 
ComponentMapConstIterator
 
typedef ComponentMap::iterator ComponentMapIterator
 
typedef IdList::const_iterator IdIterator
 
typedef std::list< int > IdList
 
typedef std::set< int > IdSet
 

Private Attributes

ComponentMap fComponentsById
 Id to object conversion map. More...
 
IdList fComponentsIds
 List of contained ids. More...
 
IdSet fComponentsIdsSet
 Set of contained ids. More...
 
SizeType fNumberOfIds
 The number of Ids. We keep the number of IDs separately because in a std::list the query for number is linear. More...
 
const P & fParent
 The parent of the components. More...
 

Detailed Description

template<class P, class C, class Creator, class ManagerProvider>
class det::ComponentGroup< P, C, Creator, ManagerProvider >

Base class for group of detector components.

This class handles the parent-child relationship for one-to-many relations. Keeps a collection of the childs, handling the creation (with proper id management) and providing iterators over it.

Parameters
PThe parent class.
CThe child class.
CreatorPolicy for obect creation.
ManagerProviderPolicy for Manager resolution.

In C it's also assumed to have this field:

Invariant
In pseudo-code:

\[ (\forall i : i \in Keys(fComponentsById) \Rightarrow i \in fComponentsIds ) \]

Author
Rodolfo Federico Gamarra
Date
09 Jan 2009

In det::DetectorComponent a friendship declaration to this template class is provided: needs to be kept in sync (ie same template argument list).

Definition at line 127 of file Detector/ComponentGroup.h.

Member Typedef Documentation

template<class P, class C, class Creator, class ManagerProvider>
typedef boost::ptr_map<int, C> det::ComponentGroup< P, C, Creator, ManagerProvider >::ComponentMap
private

Definition at line 129 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
typedef ComponentMap::const_iterator det::ComponentGroup< P, C, Creator, ManagerProvider >::ComponentMapConstIterator
private

Definition at line 150 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
typedef ComponentMap::iterator det::ComponentGroup< P, C, Creator, ManagerProvider >::ComponentMapIterator
private

Definition at line 149 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
typedef C det::ComponentGroup< P, C, Creator, ManagerProvider >::ComponentType

The type of the contained component.

Definition at line 203 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
typedef boost::transform_iterator< InternalConstFunctor, IdIterator, const C& > det::ComponentGroup< P, C, Creator, ManagerProvider >::ConstIterator

Convenience alias for constant iterators over components.

Definition at line 193 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
typedef IdList::const_iterator det::ComponentGroup< P, C, Creator, ManagerProvider >::IdIterator
private

Definition at line 148 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
typedef std::list<int> det::ComponentGroup< P, C, Creator, ManagerProvider >::IdList
private

Definition at line 138 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
typedef std::set<int> det::ComponentGroup< P, C, Creator, ManagerProvider >::IdSet
private

Definition at line 147 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
typedef boost::transform_iterator< InternalFunctor, IdIterator, C& > det::ComponentGroup< P, C, Creator, ManagerProvider >::Iterator

Convenience alias for iterators over components.

Definition at line 200 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
typedef IdList::size_type det::ComponentGroup< P, C, Creator, ManagerProvider >::SizeType

Type for number of components.

Definition at line 275 of file Detector/ComponentGroup.h.

Constructor & Destructor Documentation

template<class P, class C, class Creator, class ManagerProvider>
det::ComponentGroup< P, C, Creator, ManagerProvider >::ComponentGroup ( const P &  p)
inline

Construct with parent.

Definition at line 206 of file Detector/ComponentGroup.h.

Member Function Documentation

template<class P, class C, class Creator, class ManagerProvider>
Iterator det::ComponentGroup< P, C, Creator, ManagerProvider >::Begin ( )
inline

Begin iterator over components.

Definition at line 243 of file Detector/ComponentGroup.h.

References det::ComponentGroup< P, C, Creator, ManagerProvider >::fComponentsIds.

template<class P, class C, class Creator, class ManagerProvider>
Iterator det::ComponentGroup< P, C, Creator, ManagerProvider >::End ( )
inline

End iterator over components.

Definition at line 251 of file Detector/ComponentGroup.h.

References det::ComponentGroup< P, C, Creator, ManagerProvider >::fComponentsIds.

template<class P , class C , class Creator , class ManagerProvider >
bool det::ComponentGroup< P, C, Creator, ManagerProvider >::Exists ( int  i) const

Check for existence by id.

Definition at line 413 of file Detector/ComponentGroup.h.

template<class P , class C , class Creator , class ManagerProvider >
const C & det::ComponentGroup< P, C, Creator, ManagerProvider >::Get ( int  i) const

Retrieve component by id.

Parameters
iThe id of the contained component.

Definition at line 346 of file Detector/ComponentGroup.h.

References RdGeoCeLDFFitter::c, and ERROR.

Referenced by det::ComponentGroup< P, C, Creator, ManagerProvider >::Get().

template<class P , class C , class Creator , class ManagerProvider >
C & det::ComponentGroup< P, C, Creator, ManagerProvider >::Get ( int  i)

Retrieve component by id.

Parameters
iThe id of the contained component.

Definition at line 372 of file Detector/ComponentGroup.h.

References det::ComponentGroup< P, C, Creator, ManagerProvider >::Get().

template<class P, class C, class Creator, class ManagerProvider>
SizeType det::ComponentGroup< P, C, Creator, ManagerProvider >::GetNumberOfComponents ( ) const
inline

Returns the number of components.

Definition at line 278 of file Detector/ComponentGroup.h.

References det::ComponentGroup< P, C, Creator, ManagerProvider >::fNumberOfIds.

template<class P , class C , class Creator , class ManagerProvider >
void det::ComponentGroup< P, C, Creator, ManagerProvider >::Update ( const VManager::IndexMap m,
const bool  invalidateData = true,
const bool  invalidateComponents = true 
)

Updates the components.

Usual detector Update method.

Parameters
mThe map with the id identifying within the hierarchy.
invalidateDataOn non-first calls to update, this triggers a data invalidation so as to discard values loaded previously.
invalidateComponentsOn non-first call to update, this trigger a component list invalidation so as to discard (sub) components loaded previously.
See Also
mdet::MDetector::Update
det::DetectorComponent

Definition at line 304 of file Detector/ComponentGroup.h.

References det::VManager::eNotFound, det::VManager::GetData(), utl::s, and det::ComponentUpdater::UpdateComponent().

Member Data Documentation

template<class P, class C, class Creator, class ManagerProvider>
ConstIterator det::ComponentGroup< P, C, Creator, ManagerProvider >::const
Initial value:
{
return ConstIterator(fComponentsIds.begin(), InternalConstFunctor(*this))

Begin iterator over components.

End iterator over components.

Definition at line 227 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
ComponentMap det::ComponentGroup< P, C, Creator, ManagerProvider >::fComponentsById
mutableprivate

Id to object conversion map.

Definition at line 285 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
IdList det::ComponentGroup< P, C, Creator, ManagerProvider >::fComponentsIds
mutableprivate
template<class P, class C, class Creator, class ManagerProvider>
IdSet det::ComponentGroup< P, C, Creator, ManagerProvider >::fComponentsIdsSet
mutableprivate

Set of contained ids.

Definition at line 298 of file Detector/ComponentGroup.h.

template<class P, class C, class Creator, class ManagerProvider>
SizeType det::ComponentGroup< P, C, Creator, ManagerProvider >::fNumberOfIds
mutableprivate

The number of Ids. We keep the number of IDs separately because in a std::list the query for number is linear.

Definition at line 295 of file Detector/ComponentGroup.h.

Referenced by det::ComponentGroup< P, C, Creator, ManagerProvider >::GetNumberOfComponents().

template<class P, class C, class Creator, class ManagerProvider>
const P& det::ComponentGroup< P, C, Creator, ManagerProvider >::fParent
private

The parent of the components.

Definition at line 282 of file Detector/ComponentGroup.h.


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

, generated on Tue Sep 26 2023.