#include <AssociationManager.h>
Inheritance diagram for Atlfast::AssociationManager:
Public Methods | |
void | associate (const ContainedObject *otherEntity) |
Sets a simple one directional association between this entity and another. | |
void | associate (const SmartRef< ContainedObject > *otherEntity) |
SmartRefVector< ContainedObject > | associations () const |
Returns a list of all entities associated with this object. | |
template<class T> SmartRefVector< T > | associations (T) const |
Returns a list of all entities of a certain class which have been associated with this object. T must inherit from ContainedObject. | |
bool | unAssociated () const |
A quick way to find out whether there are any associations at all. | |
void | reset () |
Protected Attributes | |
SmartRefVector< ContainedObject > | m_associations |
This is the record of associations between ContainedObjects. |
It provides an implemetation of a general templated association\ mechanism which allows any object which inherits from ContainedObject (A special Athena class used for items in the TES) to store a reference to any other such object.
A user can then subsequently retrieve a SmartRefVector containing SmartRefs to all stored associations or to a subset selected by class type. Templates have been used to avoid the user having to cast ContainedObject to specific classes in the latter case.
Every user class which wishes to use this mechanism simply inherits AssociationManager publically.
Definition at line 47 of file AssociationManager.h.
|
Definition at line 76 of file AssociationManager.h. References m_associations.
00076 { 00077 m_associations.push_back( *otherEntity ) ; 00078 } |
|
Sets a simple one directional association between this entity and another. otherEntity is automatically converted to SmartRef<ContainedObject>(otherEntity) Definition at line 72 of file AssociationManager.h. References m_associations. Referenced by Atlfast::Cluster::Cluster(), and Atlfast::Jet::Jet().
00072 { 00073 m_associations.push_back( otherEntity ) ; 00074 00075 } |
|
Returns a list of all entities of a certain class which have been associated with this object.
Definition at line 104 of file AssociationManager.h. References m_associations.
00104 { 00105 00106 SmartRefVector<T> results ; 00107 00108 T targetType ; 00109 SmartRefVector<ContainedObject>::const_iterator assoc = 00110 m_associations.begin(); 00111 for( ; assoc != m_associations.end(); ++assoc ) { 00112 if( targetType.clID() == (*assoc)->clID() ) { 00113 00114 // Found an associated object of the correct type 00115 // Cast the contained object into required type and add to 00116 // the results 00117 const ContainedObject* temp = *assoc ; 00118 T* temp2 = (T*) temp ; 00119 results.push_back( temp2 ) ; 00120 } 00121 } 00122 return results ; 00123 } |
|
Returns a list of all entities associated with this object.
Definition at line 84 of file AssociationManager.h. References m_associations.
00084 { 00085 //Be dumb for now : make a copy of the list of associations 00086 SmartRefVector<ContainedObject> results ; 00087 SmartRefVector<ContainedObject>::const_iterator assoc = 00088 m_associations.begin(); 00089 for(; assoc != m_associations.end(); ++assoc ) { 00090 results.push_back( *assoc ) ; 00091 } 00092 return results ; 00093 } |
|
Reimplemented in Atlfast::Cell. Definition at line 131 of file AssociationManager.h. References m_associations.
00131 { m_associations.erase(m_associations.begin(), 00132 m_associations.end());} |
|
A quick way to find out whether there are any associations at all.
Definition at line 130 of file AssociationManager.h. References m_associations.
00130 { return m_associations.size() == 0 ; } |
|
This is the record of associations between ContainedObjects. It is a vector of SmartRef<ContainedObject> pointing polymorphically to other ContainedObjects in the TES.
Definition at line 58 of file AssociationManager.h. Referenced by associate(), associations(), reset(), and unAssociated(). |