Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

tcsCMD_HANDLER.h

Go to the documentation of this file.
00001 #ifndef tcsCMD_HANDLER_H
00002 #define tcsCMD_HANDLER_H
00003 /******************************************************************************
00004 * E.S.O. - VLT project
00005 *
00006 * "@(#) $Id: tcsCMD_HANDLER.h,v 1.136 2003/11/27 15:10:05 vltsccm Exp $"
00007 *
00008 * who       when      what
00009 * --------  --------  --------------------------------------------------------
00010 * rkarban  10/10/97  add IsOwnProcess
00011 * nfiebig   29/10/96  created
00012 */
00013 
00014 /******************************************************************************
00015  * Declaration of class tcsCMD_HANDLER.
00016  *-----------------------------------------------------------------------------
00017  */
00018 
00019 #ifndef __cplusplus
00020 #error This is a C++ include file and cannot be used from plain C
00021 #endif
00022 
00023 #include <evhHANDLER.h>
00024 #include <evhSTD_COMMANDS_NAMES.h>
00025 #include <evhStates.h>
00026 #include "tcs.h"
00027 #include "tcsSTATE.h"
00028 
00029 // This class is only a helper class for tcsCMD_HANDLER_T
00030 // it implements the counter for all possible active objects
00031 // independently of the implemented policy
00032 // because tcsCMD_HANDLER_T inherits from it
00033 // it must not be used 
00034 class tcsCMD_HANDLER_COUNT
00035 {
00036   protected:
00037     const vltINT32 ActiveCount() const {return activeCount;};
00038     void           IncActiveCount() {activeCount++;};
00039     void           DecActiveCount() {activeCount--;};
00040   private:
00041     static vltINT32 activeCount;
00042 };
00043 
00044 template <class StatePolicy=tcsSTATE>
00045 class tcsCMD_HANDLER_T : public StatePolicy, private tcsCMD_HANDLER_COUNT
00046 {
00047   public:
00048     tcsCMD_HANDLER_T(const dbSYMADDRESS dbRoot, const msgCMD cmdName,
00049                      const evhCALLBACK *cb = NULL, const vltLOGICAL allowMultiple = ccsFALSE);
00050     virtual ~tcsCMD_HANDLER_T();
00051     virtual ccsCOMPL_STAT Init();
00052     virtual ccsCOMPL_STAT Reset();
00053     const char   *CmdName();
00054     vltLOGICAL    IsActive();
00055     ccsCOMPL_STAT SendReply(const char *buffer, msgLENGTH size = 0, 
00056                             vltLOGICAL last = ccsTRUE);
00057     ccsCOMPL_STAT SendReply(const ccsERROR &error);
00058     void          MsgCaller(msgMESSAGE &msg);
00059     const char *  MsgCallerName();
00060     vltLOGICAL    InternalCall();
00061 
00062   protected:
00063     evhCB_COMPL_STAT CommandCB(msgMESSAGE &msg, void *udata);
00064     virtual vltLOGICAL ExecutionPermitted(msgMESSAGE &msg);
00065     virtual vltLOGICAL IsOwnProcess(msgMESSAGE &msg);
00066     virtual evhCB_COMPL_STAT Execute(msgMESSAGE &msg, void *udata);
00067     msgMESSAGE &  MsgCaller();
00068     void          SetActive(vltLOGICAL flag=TRUE);
00069 
00070   private:
00071     msgCMD       command;         // name of command handled by this instance
00072     msgMESSAGE   orgMsg;          // originator command message
00073     evhCALLBACK *userCB;          // user's command callback
00074     vltLOGICAL   cmdActive;       // flag if a command is active
00075     vltLOGICAL   allowMultiple;   // allow command multiple
00076 };
00077 
00078 
00079 #include "tcsCMD_HANDLER.icc"
00080 // __oOo__
00081 
00082 #endif // !tcsCMD_HANDLER_H

Generated on Wed Dec 3 14:52:20 2003 for ATCS API by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001