00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TReadoutElement.hh"
00017 #include "TDataElement.hh"
00018 #include "TModule.hh"
00019
00020 TReadoutElement::TReadoutElement( TModule* module, const Tstring& id, Tint ch )
00021 : TReadoutIdentification( id ), theModule( module ), theChannelNumber( ch )
00022 {
00023
00024 if ( theChannelNumber < 0 ) {
00025 Tbool isiddigit = Ttrue;
00026 for ( Tsize_t i = 0; i < theID.size(); i ++ ) {
00027 if ( !isdigit( theID[ i ] ) ) {
00028 isiddigit = Tfalse;
00029 break;
00030 }
00031 }
00032 if ( isiddigit ) {
00033 theChannelNumber = (Tint)strtol( theID.c_str(), 0, 0 );
00034 }
00035 }
00036 }
00037
00038 TReadoutElement::TReadoutElement( TModule* module, Tint ch, const Tstring& id )
00039 : TReadoutIdentification( id ), theModule( module ), theChannelNumber( ch )
00040 {
00041 if ( theID == TunknownID ) {
00042 theID = itostr( ch, 1 );
00043 }
00044 }
00045
00046 TReadoutElement::TReadoutElement( const TReadoutElement& right )
00047 : TReadoutIdentification( right ),
00048 theModule( right.theModule ),
00049 theChannelNumber( right.theChannelNumber )
00050 {;}
00051
00052 TReadoutElement::~TReadoutElement()
00053 {;}
00054
00055 TDataElement TReadoutElement::Read( Tint ch )
00056 {
00057 TDataElement element( tTypeUnknown, theID );
00058 theModule -> FillData( element, ch );
00059 return element;
00060 }
00061
00062 TDataElement TReadoutElement::Read()
00063 {
00064 return Read( theChannelNumber );
00065 }
00066
00067 const TReadoutElement& TReadoutElement::operator=( const TReadoutElement& right )
00068 {
00069 *( (TReadoutIdentification*)this ) = *( (TReadoutIdentification*)(&right) );
00070 theModule = right.theModule;
00071 theChannelNumber = right.theChannelNumber;
00072 return *this;
00073 }
00074
00075 Tbool TReadoutElement::operator==( const TReadoutElement& right ) const
00076 {
00077 Tbool retval = Ttrue;
00078 retval &= ( *( (TReadoutIdentification*)this ) == *( (TReadoutIdentification*)(&right) ) );
00079 retval &= ( *theModule == *(right.theModule) );
00080 retval &= ( theChannelNumber == right.theChannelNumber );
00081 return retval;
00082 }
00083
00084 Tbool TReadoutElement::operator!=( const TReadoutElement& right ) const
00085 {
00086 Tbool retval = Tfalse;
00087 retval |= ( *( (TReadoutIdentification*)this ) != *( (TReadoutIdentification*)(&right) ) );
00088 retval |= ( *theModule != *(right.theModule) );
00089 retval |= ( theChannelNumber != right.theChannelNumber );
00090 return retval;
00091 }
00092
00093 #ifdef __CLDAQ_ROOT_DLL
00094 ClassImp(TReadoutElement)
00095 #endif