00001 // $Id: TGo4Command.h 478 2009-10-29 12:26:09Z 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 UnExeCom(); 00050 00052 virtual Int_t RefuseCom(); 00053 00054 virtual Bool_t Log(Int_t mode = 0); 00055 00056 Bool_t IsEnabled() const; 00057 00058 Bool_t IsExclusive() const; 00059 00060 Bool_t IsLocal() const; 00061 00062 virtual void Help(); 00063 00064 Int_t GetCommandID() const; 00065 00066 Bool_t IsSynchron() const; 00067 00068 const char* GetReceiverName() const; 00069 void SetReceiverName(const char*); 00070 00071 const char* GetTaskName() const; 00072 void SetTaskName(const char*); 00073 00074 const char* What() const; 00075 void SetDescription(const char*); 00076 00077 virtual void SetReceiver(TGo4CommandReceiver * rec); 00078 00079 Go4CommandMode_t GetProtection(){return fiProtection;} 00080 Go4CommandMode_t GetMode(){return fiMode;} 00081 00085 virtual void Set(TGo4RemoteCommand* remcon); 00086 00087 void SetMode(Go4CommandMode_t m){fiMode=m;} 00088 00090 static const char* GetModeDescription(Go4CommandMode_t mode); 00091 00092 protected: 00093 00094 Bool_t fbIsEnabled; // comand can be executed 00095 Bool_t fbIsExclusive; // command can be executed only by ReceiverName 00096 Bool_t fbIsSynchron; // command is queued = synchronous 00097 Bool_t fbIsLocal; // command is to be executed by local command thread 00098 00099 Int_t fiCommandID; // command number 00100 Int_t fiVersion; // version number 00101 00103 Go4CommandMode_t fiMode; // 00106 Go4CommandMode_t fiProtection; // 00107 00108 void SetProtection(Go4CommandMode_t m){fiProtection=m;} 00109 00111 static const char* fgcMODEDESCRIPTION[]; 00112 00113 private: 00114 00115 TString fxDescription; // short description of command 00116 TString fxReceiverName; // name of receiver 00117 TString fxTaskName; // name of task 00118 00119 protected: 00120 TGo4CommandReceiver * fxReceiverBase; 00121 00122 ClassDef(TGo4Command , 1) 00123 }; 00124 00125 #endif //TGO4COMMAND_H