00001 //------------------------------------------------------------- 00002 // Go4 Release Package v3.04-01 (build 30401) 00003 // 28-November-2008 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at EE department, GSI 00007 //--------------------------------------------------------------- 00008 // 00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI 00010 // Planckstr. 1, 64291 Darmstadt, Germany 00011 //Contact: http://go4.gsi.de 00012 //---------------------------------------------------------------- 00013 //This software can be used under the license agreements as stated 00014 //in Go4License.txt file which is part of the distribution. 00015 //---------------------------------------------------------------- 00016 #include "TGo4RemoteCommand.h" 00017 00018 #include "TGo4Log.h" 00019 #include "TGo4CommandInvoker.h" 00020 00021 const char* TGo4RemoteCommand::fgxREMCOMEMPTYSTRING="--NOSTRING--"; 00022 00023 TGo4RemoteCommand::TGo4RemoteCommand() : 00024 TGo4Command(), 00025 fxCommandName("THStop"), 00026 fxAggregate(0) 00027 { 00028 InitPars(); 00029 } 00030 00031 TGo4RemoteCommand::TGo4RemoteCommand(const char* comname) : 00032 TGo4Command(), 00033 fxCommandName(comname), 00034 fxAggregate(0) 00035 { 00036 InitPars(); 00037 } 00038 00039 void TGo4RemoteCommand::InitPars() 00040 { 00041 SetName("BS_Remote"); 00042 SetDescription("Container for remote commands"); 00043 SetReceiverName("CommandInvoker"); 00044 fiCommandID = 888; 00045 fiVersion = 3; 00046 fbIsSynchron = kFALSE; 00047 fbIsEnabled = kTRUE; 00048 fbIsExclusive = kFALSE; 00049 fbIsLocal = kFALSE; 00050 for(Int_t j=0;j<__REMCOMPARS__; j++) { 00051 fxParameter[j]=fgxREMCOMEMPTYSTRING; 00052 fiValue[j]=0; 00053 } 00054 } 00055 00056 TGo4RemoteCommand::~TGo4RemoteCommand() 00057 { 00058 //delete fxAggregate; // never delete aggregate owned by gui object manager! 00059 } 00060 00061 Int_t TGo4RemoteCommand::ExeCom() 00062 { 00063 TGo4CommandInvoker* inv = dynamic_cast<TGo4CommandInvoker*> (fxReceiverBase); 00064 if(inv==0) return -1; 00065 Int_t rev=inv->ExecuteFromRemote(this); 00066 delete fxAggregate; // only cleanup on executer side if necessary! 00067 return rev; 00068 } 00069 00070 void TGo4RemoteCommand::SetAggregate(TObject* ob) 00071 { 00072 delete fxAggregate; 00073 fxAggregate = ob; 00074 } 00075 00076 TObject* TGo4RemoteCommand::GetAggregate(Bool_t chown) 00077 { 00078 TObject* rev=fxAggregate; 00079 if(chown) fxAggregate=0; // change ownership to external client 00080 return rev; 00081 } 00082 00083 void TGo4RemoteCommand::SetString(const char* txt,Int_t i) 00084 { 00085 if ((i>=0) && (i<__REMCOMPARS__)) fxParameter[i]=txt; 00086 } 00087 00088 const char* TGo4RemoteCommand::GetString(Int_t i) const 00089 { 00090 return ((i>=0) && (i<__REMCOMPARS__)) ? fxParameter[i].Data() : 0; 00091 } 00092 00093 void TGo4RemoteCommand::SetValue(Int_t num, Int_t i) 00094 { 00095 if((i>=0) && (i<__REMCOMPARS__)) fiValue[i]=num; 00096 } 00097 00098 Int_t TGo4RemoteCommand::GetValue(Int_t i) const 00099 { 00100 return ((i>=0) && (i<__REMCOMPARS__)) ? fiValue[i] : 0; 00101 } 00102 00103 const char* TGo4RemoteCommand::Get_fgxREMCOMEMPTYSTRING() 00104 { 00105 return fgxREMCOMEMPTYSTRING; 00106 } 00107 00108 //----------------------------END OF GO4 SOURCE FILE ---------------------