00001 // $Id: TGo4RemoteCommand.cxx 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 #include "TGo4RemoteCommand.h" 00015 00016 #include "TGo4Log.h" 00017 #include "TGo4CommandInvoker.h" 00018 00019 const char* TGo4RemoteCommand::fgxREMCOMEMPTYSTRING="--NOSTRING--"; 00020 00021 TGo4RemoteCommand::TGo4RemoteCommand() : 00022 TGo4Command(), 00023 fxCommandName("THStop"), 00024 fxAggregate(0) 00025 { 00026 InitPars(); 00027 } 00028 00029 TGo4RemoteCommand::TGo4RemoteCommand(const char* comname) : 00030 TGo4Command(), 00031 fxCommandName(comname), 00032 fxAggregate(0) 00033 { 00034 InitPars(); 00035 } 00036 00037 void TGo4RemoteCommand::InitPars() 00038 { 00039 SetName("BS_Remote"); 00040 SetDescription("Container for remote commands"); 00041 SetReceiverName("CommandInvoker"); 00042 fiCommandID = 888; 00043 fiVersion = 3; 00044 fbIsSynchron = kFALSE; 00045 fbIsEnabled = kTRUE; 00046 fbIsExclusive = kFALSE; 00047 fbIsLocal = kFALSE; 00048 for(Int_t j=0;j<__REMCOMPARS__; j++) { 00049 fxParameter[j]=fgxREMCOMEMPTYSTRING; 00050 fiValue[j]=0; 00051 } 00052 } 00053 00054 TGo4RemoteCommand::~TGo4RemoteCommand() 00055 { 00056 //delete fxAggregate; // never delete aggregate owned by gui object manager! 00057 } 00058 00059 Int_t TGo4RemoteCommand::ExeCom() 00060 { 00061 TGo4CommandInvoker* inv = dynamic_cast<TGo4CommandInvoker*> (fxReceiverBase); 00062 if(inv==0) return -1; 00063 Int_t rev=inv->ExecuteFromRemote(this); 00064 delete fxAggregate; // only cleanup on executer side if necessary! 00065 return rev; 00066 } 00067 00068 void TGo4RemoteCommand::SetAggregate(TObject* ob) 00069 { 00070 delete fxAggregate; 00071 fxAggregate = ob; 00072 } 00073 00074 TObject* TGo4RemoteCommand::GetAggregate(Bool_t chown) 00075 { 00076 TObject* rev=fxAggregate; 00077 if(chown) fxAggregate=0; // change ownership to external client 00078 return rev; 00079 } 00080 00081 void TGo4RemoteCommand::SetString(const char* txt,Int_t i) 00082 { 00083 if ((i>=0) && (i<__REMCOMPARS__)) fxParameter[i]=txt; 00084 } 00085 00086 const char* TGo4RemoteCommand::GetString(Int_t i) const 00087 { 00088 return ((i>=0) && (i<__REMCOMPARS__)) ? fxParameter[i].Data() : 0; 00089 } 00090 00091 void TGo4RemoteCommand::SetValue(Int_t num, Int_t i) 00092 { 00093 if((i>=0) && (i<__REMCOMPARS__)) fiValue[i]=num; 00094 } 00095 00096 Int_t TGo4RemoteCommand::GetValue(Int_t i) const 00097 { 00098 return ((i>=0) && (i<__REMCOMPARS__)) ? fiValue[i] : 0; 00099 } 00100 00101 const char* TGo4RemoteCommand::Get_fgxREMCOMEMPTYSTRING() 00102 { 00103 return fgxREMCOMEMPTYSTRING; 00104 }