GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4RemoteCommand.cxx
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4RemoteCommand.h"
15 
16 #include "TGo4CommandInvoker.h"
17 
18 const char *TGo4RemoteCommand::fgxREMCOMEMPTYSTRING="--NOSTRING--";
19 
21  TGo4Command(),
22  fxCommandName("THStop")
23 {
24  InitPars();
25 }
26 
28  TGo4Command(),
29  fxCommandName(comname)
30 {
31  InitPars();
32 }
33 
35 {
36  SetName("BS_Remote");
37  SetDescription("Container for remote commands");
38  SetReceiverName("CommandInvoker");
39  fiCommandID = 888;
40  fiVersion = 3;
41  fbIsSynchron = kFALSE;
42  fbIsEnabled = kTRUE;
43  fbIsExclusive = kFALSE;
44  fbIsLocal = kFALSE;
45  for (Int_t j = 0; j < __REMCOMPARS__; j++) {
47  fiValue[j] = 0;
48  }
49 }
50 
52 {
53  //delete fxAggregate; // never delete aggregate owned by gui object manager!
54 }
55 
57 {
58  auto inv = dynamic_cast<TGo4CommandInvoker*> (fxReceiverBase);
59  if(!inv) return -1;
60  Int_t rev=inv->ExecuteFromRemote(this);
61  delete fxAggregate; // only cleanup on executer side if necessary!
62  return rev;
63 }
64 
66 {
67  delete fxAggregate;
68  fxAggregate = ob;
69 }
70 
71 TObject *TGo4RemoteCommand::GetAggregate(Bool_t chown)
72 {
73  TObject *rev = fxAggregate;
74  if(chown) fxAggregate = nullptr; // change ownership to external client
75  return rev;
76 }
77 
78 void TGo4RemoteCommand::SetString(const char *txt,Int_t i)
79 {
80  if ((i >= 0) && (i < __REMCOMPARS__))
81  fxParameter[i] = txt;
82 }
83 
84 const char *TGo4RemoteCommand::GetString(Int_t i) const
85 {
86  return ((i >= 0) && (i < __REMCOMPARS__)) ? fxParameter[i].Data() : nullptr;
87 }
88 
89 void TGo4RemoteCommand::SetValue(Int_t num, Int_t i)
90 {
91  if ((i >= 0) && (i < __REMCOMPARS__))
92  fiValue[i] = num;
93 }
94 
95 Int_t TGo4RemoteCommand::GetValue(Int_t i) const
96 {
97  return ((i >= 0) && (i < __REMCOMPARS__)) ? fiValue[i] : 0;
98 }
99 
101 {
102  return fgxREMCOMEMPTYSTRING;
103 }
const char * GetString(Int_t i) const
Int_t fiValue[__REMCOMPARS__]
void SetReceiverName(const char *)
Definition: TGo4Command.cxx:93
TGo4CommandReceiver * fxReceiverBase
Definition: TGo4Command.h:116
Bool_t fbIsLocal
Definition: TGo4Command.h:93
TObject * GetAggregate(Bool_t chown=kTRUE)
void SetAggregate(TObject *ob)
#define __REMCOMPARS__
Int_t ExeCom() override
Int_t fiVersion
Definition: TGo4Command.h:96
Int_t ExecuteFromRemote(TGo4RemoteCommand *remcom)
Int_t fiCommandID
Definition: TGo4Command.h:95
TString fxParameter[__REMCOMPARS__]
Bool_t fbIsSynchron
Definition: TGo4Command.h:92
void SetDescription(const char *)
Int_t GetValue(Int_t i) const
void SetValue(Int_t num, Int_t i)
void SetString(const char *txt, Int_t i)
Bool_t fbIsExclusive
Definition: TGo4Command.h:91
Bool_t fbIsEnabled
Definition: TGo4Command.h:90
static const char * Get_fgxREMCOMEMPTYSTRING()
static const char * fgxREMCOMEMPTYSTRING