GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4ComRemoveClient.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 "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 
31 void TGo4ComRemoveClient::SetClient(const char *name)
32 {
33  fxClientName = name;
34 }
35 
37 {
38  fbWaitForClient = wait;
39 }
40 
42 {
43  TGo4ServerTask *serv = dynamic_cast<TGo4ServerTask *>(fxReceiverBase);
44  if (!serv) {
45  TGo4Log::Debug(" !!! ComRemoveClient ''%s'': NO RECEIVER ERROR!!!",
46  GetName());
47  return 1;
48  }
49 
50  TGo4Log::Debug(" removing client %s", fxClientName.Data());
51  Bool_t ret = serv->RemoveClient(fxClientName.Data(), fbWaitForClient);
52  if (!ret) {
53  TGo4Log::Debug(" ComRemoveClient: Sorry, the specified client is not connected ");
54  return 1;
55  }
56 
57  TGo4Log::Debug(" ComRemoveClient: Client %s is removed ", fxClientName.Data());
58  return 0;
59 }
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
static void Debug(const char *text,...) GO4_PRINTF_ARGS
Definition: TGo4Log.cxx:281
void SetClient(const char *name)