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