GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
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
18const char *TGo4RemoteCommand::fgxREMCOMEMPTYSTRING = "--NOSTRING--";
19
26
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
71TObject *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
78void TGo4RemoteCommand::SetString(const char *txt,Int_t i)
79{
80 if ((i >= 0) && (i < __REMCOMPARS__))
81 fxParameter[i] = txt;
82}
83
84const char *TGo4RemoteCommand::GetString(Int_t i) const
85{
86 return ((i >= 0) && (i < __REMCOMPARS__)) ? fxParameter[i].Data() : nullptr;
87}
88
89void TGo4RemoteCommand::SetValue(Int_t num, Int_t i)
90{
91 if ((i >= 0) && (i < __REMCOMPARS__))
92 fiValue[i] = num;
93}
94
95Int_t TGo4RemoteCommand::GetValue(Int_t i) const
96{
97 return ((i >= 0) && (i < __REMCOMPARS__)) ? fiValue[i] : 0;
98}
99
#define __REMCOMPARS__
Class that knows Command Object; When Client gets the Command it is passed to the Invoker who sets th...
Int_t ExecuteFromRemote(TGo4RemoteCommand *remcom)
Create real command from remote command and invoke it.
Int_t fiCommandID
Definition TGo4Command.h:95
Bool_t fbIsExclusive
Definition TGo4Command.h:91
Bool_t fbIsLocal
Definition TGo4Command.h:93
TGo4CommandReceiver * fxReceiverBase
void SetDescription(const char *)
Bool_t fbIsSynchron
Definition TGo4Command.h:92
Bool_t fbIsEnabled
Definition TGo4Command.h:90
void SetReceiverName(const char *)
Int_t fiVersion
Definition TGo4Command.h:96
void SetAggregate(TObject *ob)
Wrap any object ob into this command container.
Int_t ExeCom() override
Remote command will execute on the command invoker at the slave side to create and execute the correc...
TObject * fxAggregate
Optional aggregated parameter object.
static const char * Get_fgxREMCOMEMPTYSTRING()
static const char * fgxREMCOMEMPTYSTRING
TObject * GetAggregate(Bool_t chown=kTRUE)
void SetString(const char *txt, Int_t i)
Specify string parameter txt for index i to be used in executed command.
void SetValue(Int_t num, Int_t i)
Specify integer parameters to be used in executed command.
TString fxParameter[__REMCOMPARS__]
String parameters.
Int_t fiValue[__REMCOMPARS__]
Numerical parameters for command, optional.
const char * GetString(Int_t i) const
TString fxCommandName
Name of command to be executed.
Int_t GetValue(Int_t i) const