00001 00037 #ifndef ASYNC_TIMER_INCLUDED 00038 #define ASYNC_TIMER_INCLUDED 00039 00040 00041 /**************************************************************************** 00042 * 00043 * System Includes 00044 * 00045 ****************************************************************************/ 00046 00047 #include <sigc++/sigc++.h> 00048 00049 00050 00051 /**************************************************************************** 00052 * 00053 * Project Includes 00054 * 00055 ****************************************************************************/ 00056 00057 00058 00059 /**************************************************************************** 00060 * 00061 * Local Includes 00062 * 00063 ****************************************************************************/ 00064 00065 00066 00067 /**************************************************************************** 00068 * 00069 * Forward declarations 00070 * 00071 ****************************************************************************/ 00072 00073 00074 00075 /**************************************************************************** 00076 * 00077 * Namespace 00078 * 00079 ****************************************************************************/ 00080 00081 namespace Async 00082 { 00083 00084 /**************************************************************************** 00085 * 00086 * Defines & typedefs 00087 * 00088 ****************************************************************************/ 00089 00090 00091 00092 /**************************************************************************** 00093 * 00094 * Exported Global Variables 00095 * 00096 ****************************************************************************/ 00097 00098 00099 00100 /**************************************************************************** 00101 * 00102 * Class definitions 00103 * 00104 ****************************************************************************/ 00105 00116 class Timer : public SigC::Object 00117 { 00118 public: 00122 typedef enum 00123 { 00124 TYPE_ONESHOT, 00125 TYPE_PERIODIC 00126 } Type; 00127 00138 Timer(int timeout_ms = 0, Type type = TYPE_ONESHOT); 00139 00143 ~Timer(void); 00144 00149 Type type(void) const { return m_type; } 00150 00160 void setTimeout(int timeout_ms); 00161 00166 int timeout(void) const { return m_timeout_ms; } 00167 00173 void setEnable(bool do_enable); 00174 00180 bool isEnabled(void) const { return m_is_enabled; } 00181 00190 void reset(void); 00191 00200 SigC::Signal1<void, Timer *> expired; 00201 00202 00203 protected: 00204 00205 private: 00206 Type m_type; 00207 int m_timeout_ms; 00208 bool m_is_enabled; 00209 00210 }; /* class Timer */ 00211 00212 00213 } /* namespace */ 00214 00215 #endif /* ASYNC_TIMER_INCLUDED */ 00216 00217 00218 00219 /* 00220 * This file has not been truncated 00221 */ 00222