GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4ComAutosave.cxx
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4ComAutosave.h"
15 
16 #include "TGo4Log.h"
17 #include "TGo4AnalysisClientImp.h"
18 #include "TGo4AnalysisImp.h"
19 #include "TGo4RemoteCommand.h"
20 
22  TGo4AnalysisCommand("ANAutosave","Do immediate autosave"),
23  fiAutoSaveCompression(5), fbAutoSaveOverwrite(1)
24 {
25  GO4TRACE((12,"TGo4ComAutosave::TGo4ComAutosave() ctor",__LINE__, __FILE__));
26  SetReceiverName("AnalysisClient"); // this command needs client as receiver
27  // override default receiver
29 }
30 
31 
33 {
34  if(!remcom) return;
35  SetAutoSaveCompression(remcom->GetValue(0));
36  SetAutoSaveOverwrite(remcom->GetValue(1));
37  SetAutoFileName(remcom->GetString(0));
38 }
39 
41 {
42  GO4TRACE((12, "TGo4ComAutosave::ExeCom()", __LINE__, __FILE__));
43 
45  if (cli) {
47  if (ana) {
48  Bool_t autoenab = ana->IsAutoSaveOn();
49  cli->SendStatusMessage(1, kTRUE, "Autosaving now...");
50  ana->SetAutoSave(kTRUE);
52  ana->AutoSave();
53  ana->SetAutoSave(autoenab); // recover old autosave state
54  }
55 
56  } else {
57  GO4TRACE((11, "TGo4ComAutosave::ExeCom() - no receiver specified ERROR!", __LINE__, __FILE__));
58  TGo4Log::Debug(" !!! ComAutosave ''%s'': NO RECEIVER ERROR!!!", GetName());
59  return 1;
60  }
61 
62  return -1;
63 }
Bool_t IsAutoSaveOn() const
const char * GetString(Int_t i) const
void SetReceiverName(const char *)
Definition: TGo4Command.cxx:93
const char * GetAutoFileName() const
TGo4CommandReceiver * fxReceiverBase
Definition: TGo4Command.h:116
void Set(TGo4RemoteCommand *remcon) override
void SetAutoFileName(const char *name)
void SetAutoSaveFile(const char *filename=nullptr, Bool_t overwrite=kFALSE, Int_t compression=5)
Int_t ExeCom() override
void SetAutoSaveOverwrite(Bool_t over=kTRUE)
void SendStatusMessage(Int_t level, Bool_t printout, const TString &text) override
void SetAutoSaveCompression(Int_t i=5)
static void Debug(const char *text,...) GO4_PRINTF_ARGS
Definition: TGo4Log.cxx:281
void SetAutoSave(Bool_t on=kTRUE)
void SetProtection(Go4CommandMode_t m)
Definition: TGo4Command.h:104
Int_t GetValue(Int_t i) const
#define GO4TRACE(X)
Definition: TGo4Log.h:25
Int_t fiAutoSaveCompression
static TGo4Analysis * Instance()