00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef ATLFAST_ASSOCIATIONMANAGER_H
00019 #define ATLFAST_ASSOCIATIONMANAGER_H
00020
00021
00022
00023
00024 #include "GaudiKernel/ContainedObject.h"
00025 #include "GaudiKernel/SmartRefVector.h"
00026
00027
00028
00029
00030 namespace Atlfast {
00047 class AssociationManager {
00048
00049 protected:
00050
00058 SmartRefVector<ContainedObject> m_associations ;
00059
00060 public:
00061
00062
00063
00072 void associate( const ContainedObject* otherEntity ) {
00073 m_associations.push_back( otherEntity ) ;
00074
00075 }
00076 void associate( const SmartRef<ContainedObject>* otherEntity ) {
00077 m_associations.push_back( *otherEntity ) ;
00078 }
00079
00084 SmartRefVector<ContainedObject> associations( ) const {
00085
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 }
00094
00095
00096
00103 template< class T >
00104 SmartRefVector<T> associations( T ) const {
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
00115
00116
00117 const ContainedObject* temp = *assoc ;
00118 T* temp2 = (T*) temp ;
00119 results.push_back( temp2 ) ;
00120 }
00121 }
00122 return results ;
00123 }
00124
00125
00126
00130 bool unAssociated() const { return m_associations.size() == 0 ; }
00131 void reset() { m_associations.erase(m_associations.begin(),
00132 m_associations.end());}
00133 };
00134
00135 }
00136 #endif
00137
00138
00139
00140