00001 // ===================================================================== 00027 // ===================================================================== 00028 #ifndef __TINPUTOBJECTFILEONLINE_HH 00029 #define __TINPUTOBJECTFILEONLINE_HH 00030 00031 #include "Tglobals.h" 00032 #include "TInputObjectFile.hh" 00033 00034 class TStreamableObject; 00035 class TDataRecord; 00036 class TDataSection; 00037 class TDataSegment; 00038 class TDataElement; 00039 class TObjectFilter; 00040 00041 00061 class TInputObjectFileOnline 00062 : public TInputObjectFile 00063 { 00064 00065 private: 00066 enum { DEFAULT = 10 * 1000 }; // 10ms 00067 00068 private: 00069 Tint theMicroSleepTime; 00070 00071 public: 00072 TInputObjectFileOnline( const Tstring& filename, const Tstring& mode = "r", Tint utime = DEFAULT ); 00073 TInputObjectFileOnline( TObjectFilter* filter, const Tstring& filename, const Tstring& mode = "r", Tint utime = DEFAULT ); 00074 ~TInputObjectFileOnline(); 00075 00076 public: 00077 Tint Read( TStreamableObject& object ); 00078 00079 public: 00080 Tint GetMicroSleepTime() const; 00081 Tvoid SetMicroSleepTime( Tint utime ); 00082 Tbool IsSleep() const; 00083 Tvoid MicroSleep() const; 00084 00085 }; 00086 00087 inline Tint TInputObjectFileOnline::GetMicroSleepTime() const 00088 { 00089 return theMicroSleepTime; 00090 } 00091 00092 inline Tvoid TInputObjectFileOnline::SetMicroSleepTime( Tint utime ) 00093 { 00094 theMicroSleepTime = utime; 00095 return; 00096 } 00097 00098 inline Tbool TInputObjectFileOnline::IsSleep() const 00099 { 00100 return ( theMicroSleepTime > 0 ); 00101 } 00102 00103 inline Tvoid TInputObjectFileOnline::MicroSleep() const 00104 { 00105 if ( IsSleep() ) { 00106 usleep( theMicroSleepTime ); 00107 } 00108 return; 00109 } 00110 00111 #endif