GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ComRemoveClient.cxx
Go to the documentation of this file.
1 // $Id: TGo4ComRemoveClient.cxx 933 2013-01-29 15:27:58Z 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 für 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  {
50  TGo4Log::Debug(" removing client %s",fxClientName.Data());
51  Bool_t ret = serv->RemoveClient(fxClientName.Data(), fbWaitForClient);
52  if(!ret)
53  {
54  TGo4Log::Debug(" ComRemoveClient: Sorry, the specified client is not connected ");
55  return 1;
56  }
57  else
58  {
59  TGo4Log::Debug(" ComRemoveClient: Client %s is removed ",fxClientName.Data());
60  return 0;
61  }
62  }
63  else
64  {
65  TGo4Log::Debug(" !!! ComRemoveClient ''%s'': NO RECEIVER ERROR!!!",GetName());
66  return 1;
67  }
68  return -1;
69 }
virtual Bool_t RemoveClient(const char *name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE)
void SetReceiverName(const char *)
Definition: TGo4Command.cxx:92
TGo4CommandReceiver * fxReceiverBase
Definition: TGo4Command.h:117
void SetWaitForClient(Bool_t wait=kTRUE)
Bool_t fbIsLocal
Definition: TGo4Command.h:94
void SetClient(const char *name)
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:270