GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ComAutosave.cxx
Go to the documentation of this file.
1 // $Id: TGo4ComAutosave.cxx 2627 2019-10-01 08:02:45Z linev $
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 
32 {
33  GO4TRACE((12,"TGo4ComAutosave::~TGo4ComAutosave() dtor",__LINE__, __FILE__));
34 }
35 
37 {
38  if(remcom==0) return;
39  SetAutoSaveCompression(remcom->GetValue(0));
40  SetAutoSaveOverwrite(remcom->GetValue(1));
41  SetAutoFileName(remcom->GetString(0));
42 }
43 
45 {
46  GO4TRACE((12,"TGo4ComAutosave::ExeCom()",__LINE__, __FILE__));
47 
49  if (cli!=0)
50  {
52  if(ana)
53  {
54  Bool_t autoenab=ana->IsAutoSaveOn();
55  cli->SendStatusMessage(1, kTRUE,"Autosaving now...");
56  ana->SetAutoSave(kTRUE);
60  ana->AutoSave();
61  ana->SetAutoSave(autoenab); // recover old autosave state
62  }
63 
64  }
65  else
66  {
67  GO4TRACE((11,"TGo4ComAutosave::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
68  TGo4Log::Debug(" !!! ComAutosave ''%s'': NO RECEIVER ERROR!!!",GetName());
69  return 1;
70  }
71 
72  return -1;
73 }
74 
void SetReceiverName(const char *)
Definition: TGo4Command.cxx:93
virtual void SendStatusMessage(Int_t level, Bool_t printout, const TString &text)
Bool_t IsAutoSaveOn() const
TGo4CommandReceiver * fxReceiverBase
Definition: TGo4Command.h:116
void SetAutoFileName(const char *name)
void SetAutoSaveOverwrite(Bool_t over=kTRUE)
Int_t GetValue(Int_t i) const
void SetAutoSaveCompression(Int_t i=5)
virtual Int_t ExeCom()
void SetAutoSave(Bool_t on=kTRUE)
void SetProtection(Go4CommandMode_t m)
Definition: TGo4Command.h:104
const char * GetString(Int_t i) const
#define GO4TRACE(X)
Definition: TGo4Log.h:26
void SetAutoSaveFile(const char *filename=0, Bool_t overwrite=kFALSE, Int_t compression=5)
Int_t fiAutoSaveCompression
const char * GetAutoFileName() const
virtual void Set(TGo4RemoteCommand *remcon)
static TGo4Analysis * Instance()
virtual ~TGo4ComAutosave()
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:274