00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00026 #ifndef ACSTIME_TIMER_IMPL_H
00027 #define ACSTIME_TIMER_IMPL_H
00029 #ifndef __cplusplus
00030 #error This is a C++ include file and cannot be used from plain C
00031 #endif
00033 #include <baciCharacteristicComponentImpl.h>
00034 #include <baci.h>
00035 #include <ace/Timer_Heap_T.h>
00036 #include <ace/Timer_Queue_Adapters.h>
00037 #include <loggingLogger.h>
00039 #include "acstimeS.h"
00040 #include "ACSTimeError.h"
00041 #include "acstimeTimeUtil.h"
00042 #include "loggingLoggable.h"
00044
00057 class TimerImpl : public virtual acscomponent::ACSComponentImpl,
00058 public virtual POA_acstime::Timer
00059 {
00060 public:
00066 TimerImpl(
00067 const ACE_CString &name,
00068 maci::ContainerServices * containerServices);
00069
00073 virtual ~TimerImpl();
00075
00083 virtual CORBA::Long
00084 schedule(acstime::TimeoutHandler_ptr callBack,
00085 const acstime::Epoch &time,
00086 const acstime::Duration &interval);
00087
00096 virtual void
00097 cancel(CORBA::Long id);
00098
00100 private:
00101
00103 typedef ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex> Upcall;
00104
00106 typedef ACE_Timer_Heap_T<ACE_Event_Handler*,Upcall,ACE_Null_Mutex> Timer_Heap;
00107
00109 typedef ACE_Timer_Heap_Iterator_T<ACE_Event_Handler*,Upcall,ACE_Null_Mutex> Timer_Heap_Iterator;
00110
00112 typedef ACE_Thread_Timer_Queue_Adapter<Timer_Heap> Thread_Timer_Queue;
00113
00115 Thread_Timer_Queue *m_timerQueue;
00116
00118 TimerImpl(const TimerImpl&);
00119
00121 void operator= (const TimerImpl&);
00122
00124
00128 class Handler : public ACE_Event_Handler,
00129 public Logging::Loggable
00130
00131 {
00132 public:
00139 Handler(acstime::TimeoutHandler_ptr callBack,
00140 bool oneShotFlag);
00141
00145 virtual ~Handler();
00146
00155 int
00156 handle_timeout(const ACE_Time_Value&,
00157 const void*);
00158
00162 acstime::TimeoutHandler_var m_handler;
00163
00167 bool m_oneShotFlag;
00168
00169 };
00170 };
00171 #endif
00172