00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TModuleSpecified.hh"
00017
00018 TModuleSpecified::TModuleSpecified()
00019 : theModuleID(), theGroupIDs(), theModule( 0 )
00020 {
00021 theGroupIDs.clear();
00022 }
00023
00024 TModuleSpecified::TModuleSpecified( const Tstring& id, const TstringList& groups, TModule* module )
00025 : theModuleID( id ), theGroupIDs( groups ), theModule( module )
00026 {;}
00027
00028 TModuleSpecified::TModuleSpecified( const TModuleSpecified& right )
00029 : theModuleID( right.theModuleID ), theGroupIDs( right.theGroupIDs ),
00030 theModule( right.theModule )
00031 {;}
00032
00033 TModuleSpecified::~TModuleSpecified()
00034 {;}
00035
00036 const TModuleSpecified& TModuleSpecified::operator=( const TModuleSpecified& right )
00037 {
00038 theModuleID = right.theModuleID;
00039 theGroupIDs = right.theGroupIDs;
00040 theModule = right.theModule;
00041 return *this;
00042 }
00043
00044 Tbool TModuleSpecified::operator==( const TModuleSpecified& right ) const
00045 {
00046 Tbool retval = Ttrue;
00047 retval &= ( theModuleID == right.theModuleID );
00048 retval &= ( theGroupIDs == right.theGroupIDs );
00049 retval &= ( theModule == right.theModule );
00050 return retval;
00051 }
00052
00053 Tbool TModuleSpecified::operator!=( const TModuleSpecified& right ) const
00054 {
00055 Tbool retval = Tfalse;
00056 retval |= ( theModuleID != right.theModuleID );
00057 retval |= ( theGroupIDs != right.theGroupIDs );
00058 retval |= ( theModule != right.theModule );
00059 return retval;
00060 }
00061
00062 Tbool TModuleSpecified::IsSameGroup( const TstringList& groups )
00063 {
00064 for ( Tsize_t i = 0; i < theGroupIDs.size(); i ++ ) {
00065 for ( Tsize_t j = 0; j < groups.size(); j ++ ) {
00066 if ( theGroupIDs[ i ] == groups[ j ] ) {
00067 return Ttrue;
00068 }
00069 }
00070 }
00071 return Tfalse;
00072 }
00073
00074 Tbool TModuleSpecified::IsSameGroup( const TModuleSpecified& spec )
00075 {
00076 return IsSameGroup( spec.GetGroupIDs() );
00077 }
00078
00079 Tbool TModuleSpecified::IsSameGroup( const Tstring& group )
00080 {
00081 TstringList groups;
00082 groups.push_back( group );
00083 return IsSameGroup( groups );
00084 }
00085
00086 Tostream& operator<<( Tostream& tos, const TModuleSpecified& right )
00087 {
00088 tos << "ID: " << right.theModuleID << ", ";
00089 tos << "GID(s): ";
00090 Tsize_t ngroups = right.theGroupIDs.size();
00091 for ( Tsize_t i = 0; i < ngroups; i ++ ) {
00092 tos << right.theGroupIDs[ i ] << ", ";
00093 }
00094 tos << right.theModule << Tflush;
00095 return tos;
00096 }
00097
00098 #ifdef __CLDAQ_ROOT_DLL
00099 ClassImp(TModuleSpecified)
00100 #endif