00001 //--------------------------------------------------------------- 00002 // Go4 Release Package v2.10-5 (build 21005) 00003 // 03-Nov-2005 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at DVEE 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 <iostream.h> 00019 #include "Go4TaskHandler/TGo4ServerTask.h" 00020 #include "Go4TaskHandler/TGo4Master.h" 00021 #include "Go4Log/TGo4Log.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 00040 void TGo4ComRemoveClient::SetClient(const char* name) 00041 { 00042 fxClientName = name; 00043 } 00044 00045 void TGo4ComRemoveClient::SetWaitForClient(Bool_t wait) 00046 { 00047 fbWaitForClient=wait; 00048 } 00049 00050 Int_t TGo4ComRemoveClient::ExeCom() 00051 { 00052 Bool_t ret=0; 00053 TGo4ServerTask* serv=dynamic_cast<TGo4ServerTask*>(fxReceiverBase); 00054 if(serv) 00055 { 00056 TGo4Log::Debug(" removing client %s",fxClientName.Data()); 00057 ret= serv->RemoveClient(fxClientName.Data(), fbWaitForClient); 00058 if(!ret) 00059 { 00060 TGo4Log::Debug(" ComRemoveClient: Sorry, the specified client is not connected "); 00061 return 1; 00062 } 00063 else 00064 { 00065 TGo4Log::Debug(" ComRemoveClient: Client %s is removed ",fxClientName.Data()); 00066 return 0; 00067 } 00068 } 00069 else 00070 { 00071 TGo4Log::Debug(" !!! ComRemoveClient ''%s'': NO RECEIVER ERROR!!!",GetName()); 00072 return 1; 00073 } 00074 return -1; 00075 } 00076 00077 ClassImp(TGo4ComRemoveClient) 00078 00079 //----------------------------END OF GO4 SOURCE FILE ---------------------