Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

ConfigureFeeCom.hpp

00001 #ifndef CONFIGUREFEECOM
00002 #define CONFIGUREFEECOM
00003 
00004 #include "SendWithoutCoCo.hpp"
00005 #include "FedCommand.hpp"
00006 #include "FeeIclAck.hpp"
00007 #include "AnswerStruct.hpp"
00008 #include <boost/scoped_ptr.hpp>
00009 #include "ace/Synch.h"
00010 #include "WatchDog.hpp"
00011 
00015 #define CONFIGUREFEECOM_STRUCTURE "I:1;I:1;F:1;C:256"
00016 
00019 #define CFC_WATCH_DOG_TIMEOUT 10000L
00020 
00023 #define SET_FEESERVER_NAMES 0x0001
00024 
00027 #define SET_FEESERVICE_NAMES 0x0002
00028 
00031 #define SET_LOG_LEVEL 0x0003
00032 
00035 #define GET_LOG_LEVEL 0x0004
00036 
00039 #define SET_UPDATE_RATE 0x0005
00040 
00043 #define GET_UPDATE_RATE 0x0006
00044 
00047 #define SET_TIME_OUT 0x0007
00048 
00051 #define GET_TIME_OUT 0x0008
00052 
00055 #define SET_DEAD_BAND 0x0009
00056 
00059 #define GET_DEAD_BAND 0x000A
00060 //________________________________________________________________________________________
00064 #define FEESERVER_SET_DEADBAND_FLAG 0x0080      // dec 128
00065 
00070 #define FEESERVER_GET_DEADBAND_FLAG 0x0100              // dec 256
00071 
00075 #define FEESERVER_SET_ISSUE_TIMEOUT_FLAG 0x0200         // dec 512
00076 
00080 #define FEESERVER_GET_ISSUE_TIMEOUT_FLAG 0x0400         // dec 1024
00081 
00085 #define FEESERVER_SET_UPDATERATE_FLAG 0x0800            // dec 2048
00086 
00090 #define FEESERVER_GET_UPDATERATE_FLAG 0x1000            // dec 4096
00091 
00095 #define FEESERVER_SET_LOGLEVEL_FLAG 0x2000              // dec 8192
00096 
00100 #define FEESERVER_GET_LOGLEVEL_FLAG 0x4000              // dec 16384
00101 //_________________________________________________________________________________________
00105 typedef struct ContConfigureFeeCom {
00107         int commandID;
00109         int iTag;
00111         float fTag;
00113         char target[256];
00114   
00120         ContConfigureFeeCom& operator=(const ContConfigureFeeCom& rhs){
00121                         if(this==&rhs){
00122                                 return *this;
00123                         }
00124                         commandID=rhs.commandID;
00125                         iTag=rhs.iTag;
00126                         fTag=rhs.fTag;
00127                         memcpy(target,rhs.target,256);
00128                         
00129                         return *this;
00130                         
00131                 }
00132 }ContConfigureFeeCom;
00133 
00134 namespace ztt { namespace dcs{
00135 
00146 class ConfigureFeeCom:public FedCommand{
00147 
00148 public:
00155       ConfigureFeeCom(char* name,DimCommandHandler* handler):FedCommand(name,CONFIGUREFEECOM_STRUCTURE,handler),keyWatchDog(0),
00156                 mutex(),cond(mutex),iclAck(FeeIclAck::createInstance()),mWatchDog("ConfigureFeeCom",&mAnswerStruct,&busy),busy(false){
00157                 //create and start watchDog threadpool
00158                 mWatchDog.activate(THR_DETACHED|THR_NEW_LWP,5,1);
00159                 //create new message block
00160                 mb = new ACE_Message_Block((char*)&keyWatchDog);
00161         };
00165 /*      ConfigureFeeCom(const ConfigureFeeCom& conf):cond(conf.mutex){
00166                 send = conf.send;
00167                 expectedAnswer = conf.expectedAnswer;
00168                 iclAck = conf.iclAck;
00169                 busy = conf.busy;
00170         };*/
00174 /*
00175         ConfigureFeeCom operator=(const ConfigureFeeCom& conf){
00176                 send = conf.send;
00177                 expectedAnswer = conf.expectedAnswer;
00178                 iclAck = conf.iclAck;
00179                 busy = conf.busy;
00180         };*
00184       virtual ~ConfigureFeeCom();
00189       virtual bool handleCommand();
00193       virtual bool setAnswerData(const int& ID);
00199       static void* watchDog(void* objectHandler);
00203       bool isBusy();
00204         
00205 private:
00209         SendWithoutCoCo send;
00213         ACE_Thread_Mutex mutex;
00217         ACE_Message_Block* mb;
00221         ACE_Condition<ACE_Thread_Mutex> cond;
00225         //std::vector<int> expectedAnswer;
00229         boost::scoped_ptr<FeeIclAck> iclAck;
00230         
00234         int keyWatchDog;
00239         AnswerStruct mAnswerStruct;
00240 
00244         WatchDog mWatchDog;
00248         bool busy;
00249         
00250         
00251                 
00252 };
00253 inline bool ConfigureFeeCom::isBusy(){
00254         return busy;
00255 }
00256 
00257 //end namespace
00258 }}
00259 
00260 #endif
00261 

Generated on Fri Mar 30 02:54:33 2007 for InterComLayer by doxygen 1.3.5