00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00029
00030
00031 #ifndef ATLFAST_ASSOCIATIONMANAGER_H
00032 #define ATLFAST_ASSOCIATIONMANAGER_H
00033
00034
00035
00036
00037 #include "GaudiKernel/ContainedObject.h"
00038 #include "GaudiKernel/SmartRefVector.h"
00039
00040
00041
00042
00043 namespace Atlfast {
00060 class AssociationManager {
00061
00062 protected:
00063
00070 SmartRefVector<ContainedObject> m_associations ;
00071
00072 public:
00073
00074
00075
00084 void associate( const ContainedObject* otherEntity ) {
00085 m_associations.push_back( otherEntity ) ;
00086
00087 }
00088 void associate( const SmartRef<ContainedObject>* otherEntity ) {
00089 m_associations.push_back( *otherEntity ) ;
00090 }
00091
00096 SmartRefVector<ContainedObject> associations( ) const {
00097
00098 SmartRefVector<ContainedObject> results ;
00099 SmartRefVector<ContainedObject>::const_iterator assoc =
00100 m_associations.begin();
00101 for(; assoc != m_associations.end(); ++assoc ) {
00102 results.push_back( *assoc ) ;
00103 }
00104 return results ;
00105 }
00106
00107
00108
00115 template< class T >
00116 SmartRefVector<T> associations( T ) const {
00117
00118 SmartRefVector<T> results ;
00119
00120 T targetType ;
00121 SmartRefVector<ContainedObject>::const_iterator assoc =
00122 m_associations.begin();
00123 for( ; assoc != m_associations.end(); ++assoc ) {
00124 if( targetType.clID() == (*assoc)->clID() ) {
00125
00126
00127
00128
00129 const ContainedObject* temp = *assoc ;
00130 T* temp2 = (T*) temp ;
00131 results.push_back( temp2 ) ;
00132 }
00133 }
00134 return results ;
00135 }
00136
00137
00138
00142 bool unAssociated() const { return m_associations.size() == 0 ; }
00143 void reset() { m_associations.erase(m_associations.begin(),
00144 m_associations.end());}
00145 };
00146
00147 }
00148 #endif
00149
00150
00151
00152