Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4ComSaveAnalysisStatus.h"
00015
00016 #include "TGo4Log.h"
00017 #include "TGo4AnalysisClientImp.h"
00018 #include "TGo4AnalysisImp.h"
00019 #include "TGo4RemoteCommand.h"
00020
00021 TGo4ComSaveAnalysisStatus::TGo4ComSaveAnalysisStatus(const char* filename)
00022 :TGo4AnalysisCommand("ANSave","Save settings to file")
00023 {
00024 GO4TRACE((12,"TGo4ComSaveAnalysisStatus::TGo4ComSaveAnalysisStatus() ctor",__LINE__, __FILE__));
00025 SetReceiverName("AnalysisClient");
00026
00027 SetFileName(filename);
00028 SetProtection(kGo4ComModeController);
00029 }
00030
00031
00032 TGo4ComSaveAnalysisStatus::TGo4ComSaveAnalysisStatus()
00033 :TGo4AnalysisCommand("ANSave","Save settings to file")
00034 {
00035 GO4TRACE((12,"TGo4ComSaveAnalysisStatus::TGo4ComSaveAnalysisStatus() ctor",__LINE__, __FILE__));
00036 SetReceiverName("AnalysisClient");
00037
00038 SetFileName(TGo4Analysis::fgcDEFAULTSTATUSFILENAME);
00039 SetProtection(kGo4ComModeController);
00040 }
00041
00042
00043 TGo4ComSaveAnalysisStatus::~TGo4ComSaveAnalysisStatus()
00044 {
00045 GO4TRACE((12,"TGo4ComSaveAnalysisStatus::~TGo4ComSaveAnalysisStatus() dtor",__LINE__, __FILE__));
00046 }
00047
00048 void TGo4ComSaveAnalysisStatus::Set(TGo4RemoteCommand* remcom)
00049 {
00050 if(remcom==0) return;
00051 SetFileName(remcom->GetString(0));
00052 }
00053
00054
00055
00056 Int_t TGo4ComSaveAnalysisStatus::ExeCom()
00057 {
00058 GO4TRACE((12,"TGo4ComSaveAnalysisStatus::ExeCom()",__LINE__, __FILE__));
00059
00060 TGo4AnalysisClient* cli=dynamic_cast<TGo4AnalysisClient*> (fxReceiverBase);
00061 if (cli!=0)
00062 {
00063 GO4TRACE((11,"TGo4ComSaveAnalysisStatus::ExeCom() - found valid receiver",__LINE__, __FILE__));
00064
00065 TGo4Analysis* ana=TGo4Analysis::Instance();
00066 if(ana)
00067 {
00068 Bool_t ok=ana->SaveStatus( GetFileName() );
00069 if(ok)
00070 {
00071 cli->SendStatusMessage(1, kFALSE,TString::Format(
00072 "Saved analysis status to file %s.", GetFileName()));
00073 }
00074 else
00075 {
00076 cli->SendStatusMessage(3, kFALSE,TString::Format(
00077 "ERROR on Saving analysis status to file %s.", GetFileName()));
00078 }
00079 }
00080 else
00081 {
00082 cli->SendStatusMessage(3, kTRUE, TString::Format(
00083 " %s ERROR no analysis ", GetName()));
00084 }
00085 }
00086 else
00087 {
00088 GO4TRACE((11,"TGo4ComSaveAnalysisStatus::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
00089 TGo4Log::Debug(" !!! ComSaveAnalysisStatus ''%s'': NO RECEIVER ERROR!!!",GetName());
00090 return 1;
00091 }
00092
00093 return -1;
00094 }