00001 // $Id: TGo4ComRemoveClient.cxx 933 2013-01-29 15:27:58Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #include "TGo4ComRemoveClient.h" 00015 00016 #include "TGo4Log.h" 00017 #include "TGo4ServerTask.h" 00018 00019 // later second ctor with client name as parameter + advanced command list make! 00020 00021 TGo4ComRemoveClient::TGo4ComRemoveClient() : 00022 TGo4TaskHandlerCommand("SVRemoveClient","remove the specified client") 00023 { 00024 SetReceiverName("ServerTask"); // sets the receiver name checked by command invoker 00025 // receiver name neednt be class name! 00026 fbIsLocal = kTRUE; 00027 fxClientName = "currentclient"; 00028 fbWaitForClient = kTRUE; 00029 } 00030 00031 TGo4ComRemoveClient::~TGo4ComRemoveClient() 00032 { 00033 } 00034 00035 void TGo4ComRemoveClient::SetClient(const char* name) 00036 { 00037 fxClientName = name; 00038 } 00039 00040 void TGo4ComRemoveClient::SetWaitForClient(Bool_t wait) 00041 { 00042 fbWaitForClient=wait; 00043 } 00044 00045 Int_t TGo4ComRemoveClient::ExeCom() 00046 { 00047 TGo4ServerTask* serv=dynamic_cast<TGo4ServerTask*>(fxReceiverBase); 00048 if(serv) 00049 { 00050 TGo4Log::Debug(" removing client %s",fxClientName.Data()); 00051 Bool_t ret = serv->RemoveClient(fxClientName.Data(), fbWaitForClient); 00052 if(!ret) 00053 { 00054 TGo4Log::Debug(" ComRemoveClient: Sorry, the specified client is not connected "); 00055 return 1; 00056 } 00057 else 00058 { 00059 TGo4Log::Debug(" ComRemoveClient: Client %s is removed ",fxClientName.Data()); 00060 return 0; 00061 } 00062 } 00063 else 00064 { 00065 TGo4Log::Debug(" !!! ComRemoveClient ''%s'': NO RECEIVER ERROR!!!",GetName()); 00066 return 1; 00067 } 00068 return -1; 00069 }