メインページ   モジュール   名前空間一覧   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TSoftwareClockModule.cc

解説を見る。
00001 // =====================================================================
00002 //  $Id: TSoftwareClockModule.cc,v 1.5 2004/03/07 10:30:31 goiwai Exp $
00003 //  $Name: CLDAQ-1-14-03 $
00004 //  $Log: TSoftwareClockModule.cc,v $
00005 //  Revision 1.5  2004/03/07 10:30:31  goiwai
00006 //  ROOTに組みこむためのおまじないマクロを埋めこみました。
00007 //  全てにおいて完全に動作するわけではありません。
00008 //
00009 //  Revision 1.4  2003/10/06 17:02:40  goiwai
00010 //  *** empty log message ***
00011 //
00012 //  Revision 1.3  2003/07/30 16:19:11  goiwai
00013 //  ファイルにコミットログをつけることにしました.
00014 //
00015 // =====================================================================
00016 #include "TSoftwareClockModule.hh"
00017 #include "TDataSegment.hh"
00018 #include "TDataElement.hh"
00019 
00020 TSoftwareClockModule::TSoftwareClockModule( Tint nchannel )
00021   : TSoftwareModule( nchannel ), theSystemClock()
00022 {;}
00023 
00024 TSoftwareClockModule::TSoftwareClockModule( const TSoftwareClockModule& right )
00025   : TSoftwareModule( right ), 
00026     theSystemClock( right.theSystemClock )
00027 {;}
00028 
00029 TSoftwareClockModule::~TSoftwareClockModule()
00030 {;}
00031 
00032 Tint TSoftwareClockModule::Clear()
00033 {
00034   return theStatus = tStatusSuccess;
00035 }
00036 
00037 Tint TSoftwareClockModule::Update()
00038 {
00039   theSystemClock.Update();
00040   return theStatus = tStatusSuccess;
00041 }
00042 
00043 Tint TSoftwareClockModule::Initialize()
00044 {
00045   theSystemClock = TSystemClock( theSystemClock );
00046   return theStatus = tStatusSuccess;
00047 }
00048 
00049 Tvoid TSoftwareClockModule::FillData( TDataElement& element, Tint channel )
00050 {
00051   if ( channel < 0 || channel >= theNumberOfChannels ) {
00052     theStatus = -EFAULT;
00053     Tcerr << "TSoftwareClockModule::FillData: invalid ID " << channel << Tendl;
00054     element.FillData( &theStatus, tTypeInt, 1 );
00055   } else {
00056     Tint intbuf;
00057     Tstring strbuf;
00058     switch( channel ) {
00059       case tIntegerTime:
00060         intbuf = GetIntegerTime();
00061         element.FillData( &intbuf, tTypeInt, 1 );
00062         break;
00063       case tElapsedTimeOfLastInitialize:
00064         intbuf = GetElapsedTimeOfLastInitialize();
00065         element.FillData( &intbuf, tTypeInt, 1 );
00066         break;
00067       case tElapsedTimeOfLastUpdate:
00068         intbuf = GetElapsedTimeOfLastUpdate();
00069         element.FillData( &intbuf, tTypeInt, 1 );
00070         break;
00071       case tYear:
00072         intbuf = GetYear();
00073         element.FillData( &intbuf, tTypeInt, 1 );
00074         break;
00075       case tMonth:
00076         intbuf = GetMonth();
00077         element.FillData( &intbuf, tTypeInt, 1 );
00078         break;
00079       case tDay:
00080         intbuf = GetDay();
00081         element.FillData( &intbuf, tTypeInt, 1 );
00082         break;
00083       case tHour:
00084         intbuf = GetHour();
00085         element.FillData( &intbuf, tTypeInt, 1 );
00086         break;
00087       case tMinute:
00088         intbuf = GetMinute();
00089         element.FillData( &intbuf, tTypeInt, 1 );
00090         break;
00091       case tSecond:
00092         intbuf = GetSecond();
00093         element.FillData( &intbuf, tTypeInt, 1 );
00094         break;
00095       case tStringTime:
00096       default:
00097         strbuf = WhatTimeIsItNow();
00098         element.FillData( &strbuf, tTypeString, 1 );
00099         break;
00100     }
00101   }
00102   return;
00103 }
00104 
00105 const TSoftwareClockModule& TSoftwareClockModule::operator=( const TSoftwareClockModule& right )
00106 {
00107   *( (TSoftwareModule*)this ) = *( (TSoftwareModule*)(&right) );
00108   theSystemClock = right.theSystemClock;
00109   return *this;
00110 }
00111 
00112 Tbool TSoftwareClockModule::operator==( const TSoftwareClockModule& right ) const
00113 {
00114   Tbool retval = Ttrue;
00115   retval &= ( *( (TSoftwareModule*)this ) == *( (TSoftwareModule*)(&right) ) );
00116   retval &= ( theSystemClock.GetAllocatedTime() == right.theSystemClock.GetAllocatedTime() );
00117   return retval;
00118 }
00119 
00120 Tbool TSoftwareClockModule::operator!=( const TSoftwareClockModule& right ) const
00121 {
00122   Tbool retval = Tfalse;
00123   retval |= ( *( (TSoftwareModule*)this ) != *( (TSoftwareModule*)(&right) ) );
00124   retval |= ( theSystemClock.GetAllocatedTime() != right.theSystemClock.GetAllocatedTime() );
00125   return retval;
00126 }
00127 
00128 #ifdef __CLDAQ_ROOT_DLL
00129     ClassImp(TSoftwareClockModule)
00130 #endif


CLDAQ - a Class Library for DataAcQuisition (Version 1.14.3)
Go IWAI -- goiwai at users.sourceforge.jp