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