00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "TInputObjectFileOnline.hh"
00031 #include "TStreamableObject.hh"
00032 #include "TDataRecord.hh"
00033 #include "TDataSection.hh"
00034 #include "TDataSegment.hh"
00035 #include "TDataElement.hh"
00036 #include "TInputObjectFilter.hh"
00037 #include "TFileProperty.hh"
00038
00039 TInputObjectFileOnline::TInputObjectFileOnline( const Tstring& filename, const Tstring& mode, Tint utime )
00040 : TInputObjectFile( filename, mode ),
00041 theMicroSleepTime( utime )
00042 {;}
00043
00044 TInputObjectFileOnline::TInputObjectFileOnline( TInputObjectFilter* filter, const Tstring& filename, const Tstring& mode, Tint utime )
00045 : TInputObjectFile( filter, filename, mode ),
00046 theMicroSleepTime( utime )
00047 {;}
00048
00049 TInputObjectFileOnline::~TInputObjectFileOnline()
00050 {;}
00051
00052 Tint TInputObjectFileOnline::Read( TStreamableObject& object )
00053 {
00054 if ( HasFilter() ) {
00055 return theObjectFilter -> Filtering( object, this );
00056 }
00057
00058 theLastDataSize = theDataSize;
00059 theDataSize = 0;
00060
00061 static Tobject_t objecttype = object.GetObjectType();
00062
00063 switch ( objecttype ) {
00064 case tObjectDataRecord:
00065 *( (TDataRecord*)(&object) ) = getDataRecord();
00066 break;
00067 case tObjectDataSection:
00068 *( (TDataSection*)(&object) ) = getDataSection();
00069 break;
00070 case tObjectDataSegment:
00071 *( (TDataSegment*)(&object) ) = getDataSegment();
00072 break;
00073 case tObjectDataElement:
00074 *( (TDataElement*)(&object) ) = getDataElement();
00075 break;
00076 default:
00077 break;
00078 }
00079
00080 if ( theDataSize <= 0 ) {
00081 SetOffset( theTotalDataSize, TObjectFile::tSeekBegin );
00082 TFileProperty pp( theFileName );
00083 Tint ss = pp.GetTotalSize();
00084 while ( ss == pp.GetTotalSize() ) {
00085 MicroSleep();
00086 pp.Update();
00087 }
00088 Read( object );
00089 } else {
00090 theTotalDataSize += theDataSize;
00091 }
00092
00093 return theDataSize;
00094 }
00095
00096 #ifdef __CLDAQ_ROOT_DLL
00097 ClassImp(TInputObjectFileOnline)
00098 #endif