00001 // $Id: TGo4Command.h 1033 2013-11-05 15:30:01Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #ifndef TGO4COMMAND_H 00015 #define TGO4COMMAND_H 00016 00021 #include "TNamed.h" 00022 #include "TString.h" 00023 00024 class TGo4CommandReceiver; 00025 class TGo4RemoteCommand; 00026 00028 enum Go4CommandMode_t{ 00029 kGo4ComModeRefused, // no rights 00030 kGo4ComModeObserver, // client may only observe 00031 kGo4ComModeController, // client has full control as user 00032 kGo4ComModeAdministrator // full control over everything 00033 }; 00034 00036 class TGo4Command : public TNamed { 00037 public: 00038 00039 TGo4Command(); 00040 00041 TGo4Command(const char* name, const char* description, Int_t id); 00042 00043 virtual ~TGo4Command (); 00044 00046 virtual Int_t ExeCom(); 00047 00049 virtual Int_t RefuseCom(); 00050 00051 virtual Bool_t Log(Int_t mode = 0); 00052 00053 Bool_t IsEnabled() const; 00054 00055 Bool_t IsExclusive() const; 00056 00057 Bool_t IsLocal() const; 00058 00059 virtual void Help(); 00060 00061 Int_t GetCommandID() const; 00062 00063 Bool_t IsSynchron() const; 00064 00065 const char* GetReceiverName() const; 00066 void SetReceiverName(const char*); 00067 00068 const char* GetTaskName() const; 00069 void SetTaskName(const char*); 00070 00071 const char* What() const; 00072 void SetDescription(const char*); 00073 00074 virtual void SetReceiver(TGo4CommandReceiver * rec); 00075 00076 Go4CommandMode_t GetProtection(){return fiProtection;} 00077 Go4CommandMode_t GetMode(){return fiMode;} 00078 00082 virtual void Set(TGo4RemoteCommand* remcon); 00083 00084 void SetMode(Go4CommandMode_t m){fiMode=m;} 00085 00087 static const char* GetModeDescription(Go4CommandMode_t mode); 00088 00089 protected: 00090 00091 Bool_t fbIsEnabled; // comand can be executed 00092 Bool_t fbIsExclusive; // command can be executed only by ReceiverName 00093 Bool_t fbIsSynchron; // command is queued = synchronous 00094 Bool_t fbIsLocal; // command is to be executed by local command thread 00095 00096 Int_t fiCommandID; // command number 00097 Int_t fiVersion; // version number 00098 00100 Go4CommandMode_t fiMode; // 00103 Go4CommandMode_t fiProtection; // 00104 00105 void SetProtection(Go4CommandMode_t m){fiProtection=m;} 00106 00108 static const char* fgcMODEDESCRIPTION[]; 00109 00110 private: 00111 00112 TString fxDescription; // short description of command 00113 TString fxReceiverName; // name of receiver 00114 TString fxTaskName; // name of task 00115 00116 protected: 00117 TGo4CommandReceiver * fxReceiverBase; 00118 00119 ClassDef(TGo4Command , 1) 00120 }; 00121 00122 #endif //TGO4COMMAND_H