GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ComRemoveClient.cxx
Go to the documentation of this file.
1 // $Id: TGo4ComRemoveClient.cxx 3074 2021-03-13 12:59:33Z linev $
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 "TGo4ComRemoveClient.h"
15 
16 #include "TGo4Log.h"
17 #include "TGo4ServerTask.h"
18 
19 // later second ctor with client name as parameter + advanced command list make!
20 
22  TGo4TaskHandlerCommand("SVRemoveClient","remove the specified client")
23 {
24  SetReceiverName("ServerTask"); // sets the receiver name checked by command invoker
25  // receiver name neednt be class name!
26  fbIsLocal = kTRUE;
27  fxClientName = "currentclient";
28  fbWaitForClient = kTRUE;
29 }
30 
32 {
33 }
34 
35 void TGo4ComRemoveClient::SetClient(const char* name)
36 {
37  fxClientName = name;
38 }
39 
41 {
42  fbWaitForClient = wait;
43 }
44 
46 {
47  TGo4ServerTask *serv = dynamic_cast<TGo4ServerTask*>(fxReceiverBase);
48  if (!serv) {
49  TGo4Log::Debug(" !!! ComRemoveClient ''%s'': NO RECEIVER ERROR!!!",
50  GetName());
51  return 1;
52  }
53 
54  TGo4Log::Debug(" removing client %s", fxClientName.Data());
55  Bool_t ret = serv->RemoveClient(fxClientName.Data(), fbWaitForClient);
56  if (!ret) {
57  TGo4Log::Debug(" ComRemoveClient: Sorry, the specified client is not connected ");
58  return 1;
59  }
60 
61  TGo4Log::Debug(" ComRemoveClient: Client %s is removed ", fxClientName.Data());
62  return 0;
63 }
virtual Bool_t RemoveClient(const char *name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE)
void SetReceiverName(const char *)
Definition: TGo4Command.cxx:93
TGo4CommandReceiver * fxReceiverBase
Definition: TGo4Command.h:116
void SetWaitForClient(Bool_t wait=kTRUE)
Bool_t fbIsLocal
Definition: TGo4Command.h:93
void SetClient(const char *name)
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:274