ATLAS Offline Software
Loading...
Searching...
No Matches
INav4MomAssocs Class Reference

#include <INav4MomAssocs.h>

Inheritance diagram for INav4MomAssocs:
Collaboration diagram for INav4MomAssocs:

Public Types

Store Iterator Types
typedef AssociationVectorIterator asso_iterator
 association iterator type
typedef AssociationObjectIterator object_iterator
 object iterator type

Public Member Functions

 INav4MomAssocs ()
 Default constructor:
 INav4MomAssocs (const INav4MomAssocs &rhs)
 Copy constructor:
INav4MomAssocsoperator= (const INav4MomAssocs &rhs)
 Assignment operator:
 INav4MomAssocs (INav4MomAssocs &&rhs)
 Move constructor:
INav4MomAssocsoperator= (INav4MomAssocs &&rhs)
 Move operator:
 ~INav4MomAssocs ()
 Constructor with parameters:
bool assocs (const INavigable4Momentum *object, ConstDataVector< INavigable4MomentumCollection > &assocs) const
 Retrieve all the associated-to objects which have been associated to the given.
bool getAssociations (const INav4MomLink &objectLink, INav4MomLinkContainer &associatedElementLinks) const
 Retrieve all the associated-to ElementLinks_to_objects which have been associated to the given.
bool getAssociations (const INavigable4Momentum *object, INav4MomLinkContainer &associatedElementLinks) const
 Retrieve all the associated-to ElementLinks_to_objects which have been associated to the given.
bool getAssociations (const AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::object_type *objPointer, AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::asso_list &assocs) const
 Reimplement the method from the base class to not shaddow it.
bool getAssociations (const AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::object_iterator &objIter, AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::asso_list &assocs) const
 Reimplement the method from the base class to not shaddow it.
void addAssocStore (const DataLink< INav4MomAssocs > &assocStore)
 Retrieve all the associated-to objects which have been associated to the given.
std::vector< DataLink< INav4MomAssocs > > getAssocStores () const
 Return links to all other association stores.
Add Associations
Parameters
objectContainer- pointer to the object container
objectIndex- index of object in container
objectPointer- pointer to object
assoContainer- container of potentially associated objects
assoIndex- index of associated object in container
assoPointer- pointer to associated object
void addAssociation (const object_container_type *objectContainer, const object_index_type &objectIndex, const asso_container_type *assoContainer, const asso_index_type &assoIndex)

Protected Types

typedef DataLink< INav4MomAssocsINav4MomAssocsLink_t

Protected Attributes

std::map< std::string, INav4MomAssocsLink_tm_assocStores

Object and Association Iterators

The association iterators are returned for a given object, which can either be referenced by its pointer or its iterator in the internal store.

Parameters
objectPointer- pointer to a given object
objectIter- iterator to a given object
store_type m_associationMap
 internal store
object_iterator beginObject () const
 begin iterator for objects
object_iterator endObject () const
 end iterator for objects
asso_iterator beginAssociation (const object_type *objectPointer) const
 begin iterator for associations
asso_iterator endAssociation (const object_type *objectPointer) const
 end iterator for associations
const object_typegetObject (const object_iterator &objectIter) const
 get association iterators by object iterator
object_iterator findObject (const object_type *theObject) const
 finding an object with allocation
bool containsObject (const object_type *theObject) const
 testing if object is in store
size_t getNumberOfObjects () const
 retrieve number of objects in store
const asso_typegetAssociation (asso_iterator assoIter) const
 associations iterator access
asso_iterator findAssociation (const object_iterator &objectIter, const asso_type *assoPointer) const
 find association
bool containsAssociation (const object_iterator &objectIter, const asso_type *assoPointer) const
 containment check
bool getObjects (const asso_type *assoPointer, object_list &theObjects) const
 get all objects for a given association
bool getAssociations (const object_type *objPointer, asso_list &assocs) const
 get all associations for a given object
size_t size ()
 get number of associations
size_t getNumberOfAssociations (const object_type *objectPointer) const
store_iterator_type internalFind (const object_link &objectLink, const asso_link &assoLink)
 internally used find method
bool addToStore (const object_link &objectLink, const asso_link &assoLink)
 internally used function to add links to store

Argument and Internal Store Types

typedef INavigable4MomentumCollection object_container_type
typedef object_container_type::base_value_type object_type
typedef SG::GenerateIndexingPolicy< object_container_type >::type::index_type object_index_type
typedef ElementLink< object_container_typeobject_link
typedef std::list< const object_type * > object_list
typedef INavigable4MomentumCollection asso_container_type
typedef asso_container_type::base_value_type asso_type
typedef SG::GenerateIndexingPolicy< asso_container_type >::type::index_type asso_index_type
typedef std::list< const asso_type * > asso_list
typedef ElementLink< asso_container_typeasso_link
typedef ElementLinkVector< asso_container_typeasso_store
typedef asso_store::const_iterator asso_store_iterator
typedef std::map< object_link, asso_storestore_type
typedef store_type::iterator store_iterator_type
static const asso_store s_dum_asso_store

Detailed Description

Definition at line 30 of file INav4MomAssocs.h.

Member Typedef Documentation

◆ asso_container_type

◆ asso_index_type

Definition at line 58 of file AssociationMap.h.

◆ asso_iterator

typedef AssociationVectorIterator AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::asso_iterator
inherited

association iterator type

Definition at line 81 of file AssociationMap.h.

◆ asso_link

◆ asso_list

typedef std::list<const asso_type*> AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::asso_list
inherited

Definition at line 59 of file AssociationMap.h.

◆ asso_store

◆ asso_store_iterator

Definition at line 62 of file AssociationMap.h.

◆ asso_type

◆ INav4MomAssocsLink_t

Definition at line 133 of file INav4MomAssocs.h.

◆ object_container_type

Definition at line 44 of file AssociationMap.h.

◆ object_index_type

Definition at line 49 of file AssociationMap.h.

◆ object_iterator

object iterator type

Definition at line 84 of file AssociationMap.h.

◆ object_link

◆ object_list

typedef std::list<const object_type*> AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::object_list
inherited

Definition at line 51 of file AssociationMap.h.

◆ object_type

◆ store_iterator_type

typedef store_type::iterator AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::store_iterator_type
inherited

Definition at line 64 of file AssociationMap.h.

◆ store_type

Definition at line 63 of file AssociationMap.h.

Constructor & Destructor Documentation

◆ INav4MomAssocs() [1/3]

INav4MomAssocs::INav4MomAssocs ( )
default

Default constructor:

◆ INav4MomAssocs() [2/3]

INav4MomAssocs::INav4MomAssocs ( const INav4MomAssocs & rhs)
default

Copy constructor:

◆ INav4MomAssocs() [3/3]

INav4MomAssocs::INav4MomAssocs ( INav4MomAssocs && rhs)
default

Move constructor:

◆ ~INav4MomAssocs()

INav4MomAssocs::~INav4MomAssocs ( )
inline

Constructor with parameters:

Inline methods:

Destructor:

Definition at line 144 of file INav4MomAssocs.h.

145{}

Member Function Documentation

◆ addAssociation()

void AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::addAssociation ( const object_container_type * objectContainer,
const object_index_type & objectIndex,
const asso_container_type * assoContainer,
const asso_index_type & assoIndex )
inherited

◆ addAssocStore()

void INav4MomAssocs::addAssocStore ( const DataLink< INav4MomAssocs > & assocStore)

Retrieve all the associated-to objects which have been associated to the given.

Parameters
object

connect this association container to other ones. It is meant to be able to have underlying association stores which can be queried and laying into StoreGate without having to copy them.

Definition at line 161 of file INav4MomAssocs.cxx.

162{
163 const std::string& id = assocStore.dataID();
164 const std::map<std::string, DataLink<INav4MomAssocs> >::const_iterator itr = m_assocStores.find(id);
165 if ( itr != m_assocStores.end() ) {
166 m_assocStores[id] = assocStore;
167 }
168}
std::map< std::string, INav4MomAssocsLink_t > m_assocStores

◆ addToStore()

bool AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::addToStore ( const object_link & objectLink,
const asso_link & assoLink )
protectedinherited

internally used function to add links to store

◆ assocs()

bool INav4MomAssocs::assocs ( const INavigable4Momentum * object,
ConstDataVector< INavigable4MomentumCollection > & assocs ) const

Retrieve all the associated-to objects which have been associated to the given.

Parameters
object

Definition at line 37 of file INav4MomAssocs.cxx.

39{
40 if ( 0 == object ) {
41 return false;
42 }
43
44 // do the underlying stores contain this object ?
45 bool contained = false;
46 for ( std::map<std::string, DataLink<INav4MomAssocs> >::const_iterator itr = m_assocStores.begin();
47 itr != m_assocStores.end();
48 ++itr ) {
49 if ( itr->second->assocs(object, associatedElems) ) {
50 contained = true;
51 }
52 }
53
54 if ( !contained && !containsObject( object ) ) {
55 return false;
56 }
57
58 associatedElems.reserve( associatedElems.size() +
62 itr != endAssocs;
63 ++itr ) {
64 associatedElems.push_back( const_cast<INavigable4Momentum*>(*itr) );
65 }
66
67 return true;
68}
asso_iterator beginAssociation(const object_type *objectPointer) const
asso_iterator endAssociation(const object_type *objectPointer) const

◆ beginAssociation()

asso_iterator AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::beginAssociation ( const object_type * objectPointer) const
inherited

begin iterator for associations

◆ beginObject()

begin iterator for objects

◆ containsAssociation()

bool AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::containsAssociation ( const object_iterator & objectIter,
const asso_type * assoPointer ) const
inlineinherited

containment check

Definition at line 165 of file AssociationMap.h.

templated base class for a look-up map for associations
bool containsAssociation(const object_iterator &objectIter, const asso_type *assoPointer) const
containment check

◆ containsObject()

bool AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::containsObject ( const object_type * theObject) const
inlineinherited

testing if object is in store

Definition at line 143 of file AssociationMap.h.

◆ endAssociation()

asso_iterator AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::endAssociation ( const object_type * objectPointer) const
inherited

end iterator for associations

◆ endObject()

end iterator for objects

◆ findAssociation()

asso_iterator AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::findAssociation ( const object_iterator & objectIter,
const asso_type * assoPointer ) const
inlineinherited

find association

Definition at line 158 of file AssociationMap.h.

asso_iterator findAssociation(const object_iterator &objectIter, const asso_type *assoPointer) const
find association

◆ findObject()

◆ getAssociation()

const asso_type * AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::getAssociation ( asso_iterator assoIter) const
inlineinherited

associations iterator access

The associations are accessed as function of the row key (the object).

Definition at line 154 of file AssociationMap.h.

155 { return *assoIter; }

◆ getAssociations() [1/5]

bool AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::getAssociations ( const object_type * objPointer,
asso_list & assocs ) const
inherited

get all associations for a given object

◆ getAssociations() [2/5]

Reimplement the method from the base class to not shaddow it.

Definition at line 100 of file INav4MomAssocs.h.

104 {
107 }
DataVector< INavigable4Momentum > INavigable4MomentumCollection
bool assocs(const INavigable4Momentum *object, ConstDataVector< INavigable4MomentumCollection > &assocs) const
Retrieve all the associated-to objects which have been associated to the given.
bool getAssociations(const INav4MomLink &objectLink, INav4MomLinkContainer &associatedElementLinks) const
Retrieve all the associated-to ElementLinks_to_objects which have been associated to the given.

◆ getAssociations() [3/5]

Reimplement the method from the base class to not shaddow it.

Definition at line 90 of file INav4MomAssocs.h.

◆ getAssociations() [4/5]

bool INav4MomAssocs::getAssociations ( const INav4MomLink & objectLink,
INav4MomLinkContainer & associatedElementLinks ) const

Retrieve all the associated-to ElementLinks_to_objects which have been associated to the given.

Parameters
objectLink

Definition at line 73 of file INav4MomAssocs.cxx.

75{
76 if ( !objectLink.isValid() )
77 {
78 return false;
79 }
80
81 // Get the object
82 const INavigable4Momentum* object(NULL);
83 object = (*objectLink);
84 if ( object == NULL )
85 {
86 return false;
87 }
88
89 return getAssociations( object, associatedElementLinks );
90}

◆ getAssociations() [5/5]

bool INav4MomAssocs::getAssociations ( const INavigable4Momentum * object,
INav4MomLinkContainer & associatedElementLinks ) const

Retrieve all the associated-to ElementLinks_to_objects which have been associated to the given.

Parameters
object

Definition at line 96 of file INav4MomAssocs.cxx.

98{
99 if ( 0 == object )
100 {
101 return false;
102 }
103
104 // do the underlying stores contain this object ?
105 bool contained = false;
106 for ( std::map<std::string, DataLink<INav4MomAssocs> >::const_iterator itr = m_assocStores.begin();
107 itr != m_assocStores.end();
108 ++itr )
109 {
110 if ( itr->second->getAssociations( object, associatedElementLinks ) )
111 {
112 contained = true;
113 }
114 }
115
116 if ( !contained && !containsObject( object ) )
117 {
118 return false;
119 }
120
121 // check key
122 store_type::const_iterator mapEnd = m_associationMap.end();
123 store_type::const_iterator foundIter = mapEnd;
124 for ( store_type::const_iterator iMap = m_associationMap.begin();
125 iMap != mapEnd;
126 ++iMap )
127 {
128 // look for the address of the pointed-at object
129 // must dereference the ElementLink pointer
130 if ( &*(*(iMap->first)) == &*(object) )
131 {
132 foundIter = iMap;
133 break;
134 }
135 }
136 if ( foundIter == m_associationMap.end() )
137 {
138 return false;
139 }
140
141 // Now, loop over all associations and fill the vector of associations
142 associatedElementLinks.reserve( associatedElementLinks.size() +
143 getNumberOfAssociations(object) );
146 for ( ; assoItr != assoItrEnd; ++assoItr )
147 {
148 const INav4MomLink assoLink = (*assoItr);
149 associatedElementLinks.push_back( assoLink );
150 }
151
152 return true;
153}
ELVIterator< typename RefVector::const_iterator > const_iterator

◆ getAssocStores()

std::vector< DataLink< INav4MomAssocs > > INav4MomAssocs::getAssocStores ( ) const

Return links to all other association stores.

Definition at line 171 of file INav4MomAssocs.cxx.

172{
173 std::vector<DataLink<INav4MomAssocs> > ret;
174 ret.reserve (m_assocStores.size());
175 for (const auto& p : m_assocStores) {
176 ret.push_back (p.second);
177 }
178 return ret;
179}

◆ getNumberOfAssociations()

size_t AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::getNumberOfAssociations ( const object_type * objectPointer) const
inlineinherited

◆ getNumberOfObjects()

size_t AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::getNumberOfObjects ( ) const
inlineinherited

retrieve number of objects in store

Definition at line 147 of file AssociationMap.h.

147{ return this->size(); }

◆ getObject()

const object_type * AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::getObject ( const object_iterator & objectIter) const
inlineinherited

get association iterators by object iterator

type-safe retrieval of object pointer from iterator

Definition at line 135 of file AssociationMap.h.

136 { return (*objectIter).getObject(); }

◆ getObjects()

bool AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::getObjects ( const asso_type * assoPointer,
object_list & theObjects ) const
inherited

get all objects for a given association

◆ internalFind()

store_iterator_type AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::internalFind ( const object_link & objectLink,
const asso_link & assoLink )
inlineprotectedinherited

internally used find method

Definition at line 210 of file AssociationMap.h.

212 {
213 // check key
217 iMap != mapEnd;
218 ++iMap ) {
219 // look for the address of the pointed-at object
220 // must dereference the ElementLink pointer
221 if ( iMap->first.cptr() == objectLink.cptr() ) {
222 foundIter = iMap;
223 break;
224 }
225 }
226
227 if ( foundIter == m_associationMap.end() ) { return foundIter; }
228 // check data
229 if ( std::find((foundIter->second).begin(),
230 (foundIter->second).end(),
231 assoLink) !=
232 (foundIter->second).end() )
233 { return foundIter; }
234 // not found at all
235 return m_associationMap.end();
236 }

◆ operator=() [1/2]

INav4MomAssocs & INav4MomAssocs::operator= ( const INav4MomAssocs & rhs)
default

Assignment operator:

◆ operator=() [2/2]

INav4MomAssocs & INav4MomAssocs::operator= ( INav4MomAssocs && rhs)
default

Move operator:

◆ size()

get number of associations

Definition at line 188 of file AssociationMap.h.

188{ return m_associationMap.size(); }

Member Data Documentation

◆ m_associationMap

internal store

Definition at line 207 of file AssociationMap.h.

◆ m_assocStores

std::map<std::string, INav4MomAssocsLink_t> INav4MomAssocs::m_assocStores
protected

Definition at line 134 of file INav4MomAssocs.h.

◆ s_dum_asso_store

Definition at line 68 of file AssociationMap.h.


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