Go to the documentation of this file.00001 #ifndef __TIMER_H__
00002 #define __TIMER_H__
00003
00004 #if !defined( WIN32_PLATFORM ) && !defined( NIX_PLATFORM ) && !defined( MINGW_PLATFORM ) && !defined( CYGWIN_PLATFORM )
00005 #define WIN32_PLATFORM
00006 #endif
00007
00008 #include <system/thread_abstraction.h>
00009
00010 #if defined( NIX_PLATFORM )
00011 #define TIMER_ABSTRACTION_DLL_ENTITY
00012 #endif
00013
00014 #ifdef TIMER
00015 #if defined( WIN32_PLATFORM ) || defined( MINGW_PLATFORM ) || defined( CYGWIN_PLATFORM )
00016 #define TIMER_ABSTRACTION_DLL_ENTITY __declspec( dllexport )
00017 #endif
00018 #else
00019 #if defined( WIN32_PLATFORM )
00020 #define TIMER_ABSTRACTION_DLL_ENTITY __declspec( dllimport )
00021 #pragma comment( lib , "thread_abstraction.lib" )
00022 #endif
00023
00024 #if defined( CYGWIN_PLATFORM ) || defined( MINGW_PLATFORM )
00025 #define TIMER_ABSTRACTION_DLL_ENTITY __declspec( dllimport )
00026 #endif
00027 #endif
00028
00029 namespace nitro
00030 {
00031
00044 class TIMER_ABSTRACTION_DLL_ENTITY Timer{
00045 public:
00046
00061 Timer( void );
00062
00081 void SetTimeout( const std::size_t theTimeout );
00082
00101 void SetInstant( const bool theInstant );
00102
00121 void SetSingle( const bool theSingle );
00122
00137 void Run( void );
00138
00153 virtual void Action( void );
00154
00165 virtual ~Timer();
00166
00167 private:
00168
00179 std::size_t Timeout;
00180
00191 bool Instant;
00192
00203 bool Single;
00204
00215 ThreadAbstraction TimerThread;
00216
00227 Timer( const Timer & ){}
00228
00239 Timer operator=( const Timer & ){return( *this );}
00240
00251 friend void * _TimerWrapperFunction( void * );
00252
00253 };
00254
00255 }
00256
00257 #endif