00001 // $Id: TGo4ComRemoveClient.cxx 478 2009-10-29 12:26:09Z 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 "Riostream.h" 00017 00018 #include "TGo4Log.h" 00019 #include "TGo4ServerTask.h" 00020 00021 // later second ctor with client name as parameter + advanced command list make! 00022 00023 TGo4ComRemoveClient::TGo4ComRemoveClient() 00024 :TGo4TaskHandlerCommand("SVRemoveClient","remove the specified client") 00025 { 00026 SetReceiverName("ServerTask"); // sets the receiver name checked by command invoker 00027 // receiver name neednt be class name! 00028 fbIsLocal = kTRUE; 00029 fxClientName = "currentclient"; 00030 fbWaitForClient = kTRUE; 00031 } 00032 00033 TGo4ComRemoveClient::~TGo4ComRemoveClient() 00034 { 00035 } 00036 00037 void TGo4ComRemoveClient::SetClient(const char* name) 00038 { 00039 fxClientName = name; 00040 } 00041 00042 void TGo4ComRemoveClient::SetWaitForClient(Bool_t wait) 00043 { 00044 fbWaitForClient=wait; 00045 } 00046 00047 Int_t TGo4ComRemoveClient::ExeCom() 00048 { 00049 Bool_t ret=0; 00050 TGo4ServerTask* serv=dynamic_cast<TGo4ServerTask*>(fxReceiverBase); 00051 if(serv) 00052 { 00053 TGo4Log::Debug(" removing client %s",fxClientName.Data()); 00054 ret= serv->RemoveClient(fxClientName.Data(), fbWaitForClient); 00055 if(!ret) 00056 { 00057 TGo4Log::Debug(" ComRemoveClient: Sorry, the specified client is not connected "); 00058 return 1; 00059 } 00060 else 00061 { 00062 TGo4Log::Debug(" ComRemoveClient: Client %s is removed ",fxClientName.Data()); 00063 return 0; 00064 } 00065 } 00066 else 00067 { 00068 TGo4Log::Debug(" !!! ComRemoveClient ''%s'': NO RECEIVER ERROR!!!",GetName()); 00069 return 1; 00070 } 00071 return -1; 00072 }