00001 // ===================================================================== 00038 // ===================================================================== 00039 #ifndef CLDAQ__TINPUTOBJECTFILEONLINE_HH 00040 #define CLDAQ__TINPUTOBJECTFILEONLINE_HH 00041 00042 #include "Tglobals.h" 00043 #include "TInputObjectFile.hh" 00044 00045 class TStreamableObject; 00046 class TDataRecord; 00047 class TDataSection; 00048 class TDataSegment; 00049 class TDataElement; 00050 class TObjectFilter; 00051 class TInputObjectFilter; 00052 00053 00073 class TInputObjectFileOnline 00074 : public TInputObjectFile 00075 { 00076 00077 private: 00078 enum { DEFAULT = 10 * 1000 }; // 10ms 00079 00080 private: 00081 Tint theMicroSleepTime; 00082 00083 public: 00084 TInputObjectFileOnline( const Tstring& filename, const Tstring& mode = "r", Tint utime = DEFAULT ); 00085 TInputObjectFileOnline( TInputObjectFilter* filter, const Tstring& filename, const Tstring& mode = "r", Tint utime = DEFAULT ); 00086 ~TInputObjectFileOnline(); 00087 00088 public: 00089 Tint Read( TStreamableObject& object ); 00090 00091 public: 00092 Tint GetMicroSleepTime() const; 00093 Tvoid SetMicroSleepTime( Tint utime ); 00094 Tbool IsSleep() const; 00095 Tvoid MicroSleep() const; 00096 00097 }; 00098 00099 inline Tint TInputObjectFileOnline::GetMicroSleepTime() const 00100 { 00101 return theMicroSleepTime; 00102 } 00103 00104 inline Tvoid TInputObjectFileOnline::SetMicroSleepTime( Tint utime ) 00105 { 00106 theMicroSleepTime = utime; 00107 return; 00108 } 00109 00110 inline Tbool TInputObjectFileOnline::IsSleep() const 00111 { 00112 return ( theMicroSleepTime > 0 ); 00113 } 00114 00115 inline Tvoid TInputObjectFileOnline::MicroSleep() const 00116 { 00117 if ( IsSleep() ) { 00118 usleep( theMicroSleepTime ); 00119 } 00120 return; 00121 } 00122 00123 #endif