00001 // ===================================================================== 00002 // $Id: TSoftwareRunInformationModule.cc,v 1.4 2004/03/07 10:30:31 goiwai Exp $ 00003 // $Name: CLDAQ-1-14-03 $ 00004 // $Log: TSoftwareRunInformationModule.cc,v $ 00005 // Revision 1.4 2004/03/07 10:30:31 goiwai 00006 // ROOTに組みこむためのおまじないマクロを埋めこみました。 00007 // 全てにおいて完全に動作するわけではありません。 00008 // 00009 // Revision 1.3 2003/10/06 17:02:40 goiwai 00010 // *** empty log message *** 00011 // 00012 // Revision 1.2 2003/07/30 16:19:11 goiwai 00013 // ファイルにコミットログをつけることにしました. 00014 // 00015 // ===================================================================== 00016 #include "TSoftwareRunInformationModule.hh" 00017 #include "TRunInformation.hh" 00018 #include "TDataSegment.hh" 00019 #include "TDataElement.hh" 00020 00021 TSoftwareRunInformationModule::TSoftwareRunInformationModule() 00022 : TSoftwareModule( 0 ), theRunInformationTable() 00023 { 00024 theRunInformationTable.Clear(); 00025 theNumberOfChannels = theRunInformationTable.GetNumberOfRows(); 00026 } 00027 00028 TSoftwareRunInformationModule::TSoftwareRunInformationModule( const TRunInformationTable& table ) 00029 : TSoftwareModule( 0 ), theRunInformationTable( table ) 00030 { 00031 theNumberOfChannels = theRunInformationTable.GetNumberOfRows(); 00032 } 00033 00034 TSoftwareRunInformationModule::TSoftwareRunInformationModule( const TSoftwareRunInformationModule& right ) 00035 : TSoftwareModule( right ), theRunInformationTable( right.theRunInformationTable ) 00036 { 00037 theNumberOfChannels = theRunInformationTable.GetNumberOfRows(); 00038 } 00039 00040 TSoftwareRunInformationModule::~TSoftwareRunInformationModule() 00041 {;} 00042 00043 Tvoid TSoftwareRunInformationModule::FillData( TDataElement& element, Tint channel ) 00044 { 00045 if ( channel < 0 || channel >= theNumberOfChannels ) { 00046 Tcerr << "TSoftwareRunInformationModule::FillData: invalid ID " << channel << Tendl; 00047 theStatus = -EFAULT; 00048 element.FillData( &theStatus, tTypeInt, 1 ); 00049 } else { 00050 const TRunInformationList& list = theRunInformationTable.GetRunInformationList(); 00051 Tstring item = list[ channel ].GetItem(); 00052 Tstring value = list[ channel ].GetValue(); 00053 element.FillData( &value, tTypeString, 1 ); 00054 element.SetID( item ); 00055 } 00056 return; 00057 } 00058 00059 const TSoftwareRunInformationModule& TSoftwareRunInformationModule::operator=( const TSoftwareRunInformationModule& right ) 00060 { 00061 *( (TSoftwareModule*)this ) = *( (TSoftwareModule*)(&right) ); 00062 theRunInformationTable = right.theRunInformationTable; 00063 return *this; 00064 } 00065 00066 Tbool TSoftwareRunInformationModule::operator==( const TSoftwareRunInformationModule& right ) const 00067 { 00068 Tbool retval = Ttrue; 00069 retval &= ( *( (TSoftwareModule*)this ) == *( (TSoftwareModule*)(&right) ) ); 00070 retval &= ( theRunInformationTable == right.theRunInformationTable ); 00071 return retval; 00072 } 00073 00074 Tbool TSoftwareRunInformationModule::operator!=( const TSoftwareRunInformationModule& right ) const 00075 { 00076 Tbool retval = Tfalse; 00077 retval |= ( *( (TSoftwareModule*)this ) != *( (TSoftwareModule*)(&right) ) ); 00078 retval |= ( theRunInformationTable != right.theRunInformationTable ); 00079 return retval; 00080 } 00081 00082 Tint TSoftwareRunInformationModule::Clear() 00083 { 00084 //should be called Clear()? 00085 //for ( Tsize_t i = 0; i < theRunInformationTable.size(); i ++ ) { 00086 //theRunInformationTable[ i ].Clear(); 00087 //} 00088 return theStatus = tStatusSuccess; 00089 } 00090 00091 Tint TSoftwareRunInformationModule::Update() 00092 { 00093 theNumberOfChannels = theRunInformationTable.GetNumberOfRows(); 00094 return theStatus = tStatusSuccess; 00095 } 00096 00097 Tint TSoftwareRunInformationModule::Initialize() 00098 { 00099 //should be called Remove()? 00100 theRunInformationTable.Clear(); 00101 theNumberOfChannels = theRunInformationTable.GetNumberOfRows(); 00102 return theStatus = tStatusSuccess; 00103 } 00104 00105 #ifdef __CLDAQ_ROOT_DLL 00106 ClassImp(TSoftwareRunInformationModule) 00107 #endif