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