00001 #ifndef WATCH_DOG
00002 #define WATCH_DOG
00003
00004 #include "ace/Task.h"
00005 #include "ace/Synch.h"
00006 #include "FeeIclAck.hpp"
00007 #include "AnswerStruct.hpp"
00008 #include "FedCommand.hpp"
00009
00010
00011 namespace ztt{
00012 namespace dcs{
00013
00014
00015
00024 class WatchDog : public ACE_Task<ACE_MT_SYNCH>
00025 {
00026 public:
00034 WatchDog(const char* channelName, AnswerStruct* pAnswerStr,bool* commandBusy):mutex(),condition(mutex),pAnswerStruct(pAnswerStr),
00035 mpFeeIclAck(FeeIclAck::createInstance()),mcChannelName(channelName),mpCommandChannelBusyFlag(commandBusy){};
00036 ~WatchDog(void){
00037 mutex.remove();
00038 };
00042 virtual int svc(void);
00046 void wakeUp(void);
00047
00048
00049
00050
00051
00052 void processTimeOut(ACE_Message_Block* mb);
00053 void setCommandHandler(FedCommand* fedCom);
00054
00055
00056 private:
00057
00058 const char* mcChannelName;
00059
00060 ACE_Condition<ACE_Thread_Mutex> condition;
00061
00062 ACE_Thread_Mutex mutex;
00063
00064 AnswerStruct* pAnswerStruct;
00065
00066 FeeIclAck* mpFeeIclAck;
00067 bool* mpCommandChannelBusyFlag;
00068
00069 };
00070 inline void WatchDog::wakeUp(){
00071 condition.signal();
00072 }
00073 }}
00074
00075 #endif