Logo coherent WaveBurst  
Library Reference Guide
Logo
History.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Stefano Longo, Gabriele Vedovato
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 /***************************************************************************
20  History.h - description
21  -------------------
22  begin : lun set 5 2005
23  copyright : (C) 2005 by Stefano Longo
24  email : Stefano.Longo@lnl.infn.it
25  ***************************************************************************/
26 
27 /***************************************************************************
28  * *
29  * This program is free software; you can redistribute it and/or modify *
30  * it under the terms of the GNU General Public License as published by *
31  * the Free Software Foundation; either version 2 of the License, or *
32  * (at your option) any later version. *
33  * *
34  ***************************************************************************/
35 
36 #ifndef HISTORY_H
37 #define HISTORY_H
38 
39 #include "TObject.h"
40 #include "TList.h"
41 #include "TObjString.h"
42 #include "TDatime.h"
43 #include "TTimeStamp.h"
44 #include <iostream>
45 
46 #include "HistoryStage.hh"
47 #include "HistoryDefines.hh"
48 
49 #define HEADER_WIDTH 80
50 
51 
52 using namespace std;
53 
54 namespace CWB {
55 
56 class History : public TObject {
57 public:
58  History(char** StageNames = NULL, int StageNumber = 0, char** TypeNames = NULL, int TypeNumber = 0, char* FilePrefix = NULL, bool HistoryModify = false);
59  History(const History& History);
60  ~History();
61 
62  bool StageAllowed(char* Name);
63  bool StageAlreadyPresent(char* Name);
64 
65  bool NameAllowed(char* Name);
66  bool TypeAllowed(char* Name);
67 
68  void SetStageNames(char** StageNames, int StageNumber);
69  void SetTypeNames(char** TypeNames, int TypeNumber);
70 
71  void AddLog(char* Stage, char* Log, TDatime* Time = NULL);
72  void AddLog(char* Stage, char* Log, int Date, int Time);
73 
74  void AddHistory(char* Stage, char* Type, char* History, TDatime* Time = NULL);
75  void AddHistory(char* Stage, char* Type, char* History, int Date, int Time);
76 
77  void SetFilePrefix(char* FilePrefix);
78  char* GetFilePrefix();
79 
80  char* GetHistory(char* StageName, char* Type);
81  TDatime* GetHistoryDatime(char* StageName, char* Type);
82 
83  int GetLogSize(char* Stage);
84  char* GetLog(char* Stage, int index);
85 
86  virtual void Browse(TBrowser *b);
87  void Print(); // *MENU*
88  void PrintSummary(); // *MENU*
89  void DumpToTextFile(char* FileName = NULL); // *MENU*
90  void DumpToROOTFile(char* FileName = NULL); // *MENU*
91 
92  TList* GetStageNames();
93  TList* GetTypeNames();
94 
95  bool SetHistoryModify(bool Replace = true);
96  bool GetHistoryModify();
97 
98  char* AddStage(char* StageName);
99  char* RemoveStage(char* StageName);
100 
101  char* AddType(char* TypeName);
102  char* RemoveType(char* TypeName);
103 
104  char* SetStageComment(char* Stage, char* Comment = NULL);
105  char* SetTypeComment(char* Stage, char* Type, char* Comment = NULL);
106 
107  char* GetStageComment(char* Stage);
108  char* GetTypeComment(char* Stage, char* Type);
109 
110  SortOrderType SetSortOrder(SortOrderType SortOrder);
111  SortOrderType GetSortOrder();
112 
113  bool IsSortOrderInsertion();
114  bool IsSortOrderDate();
115  bool IsSortOrderAlphabetical();
116 
117  bool SetAscendingSortOrder();
118  bool SetDescendantSortOrder();
119 
120  bool GetAscendingSortOrder();
121  bool GetDescendantSortOrder();
122 
123  void Sort();
124 
125  TTimeStamp GetCreationTimeStamp();
126  TTimeStamp GetCreationTimeStamp(char* Stage);
127 
128  const CWB::HistoryStage* GetStage(char* Name);
129 
130  void HistoryException(int type, const char *location, const char *msgfmt, ...);
131 
132 private:
133  void Init();
134  void Destroy();
135  bool DuplicateNames(char** NameList, int NameNumber);
136  void WriteToFile(char* FileName, bool SummaryOnly = false);
137  int GetStagePosition(char* Name);
138 
139  TList StageNames;
140  TList TypeNames;
141 
142  TList StageList;
143  TObjString FilePrefix;
144 
148 
151 
152  ClassDef(History, 3)
153 };
154 
155 } // end namespace
156 
157 #endif
void Init()
Definition: ChirpMass.C:284
bool HistoryModify
Definition: History.hh:145
Definition: ced.hh:42
long CreationDate_Sec
Definition: History.hh:149
SortOrderType
history AddLog(job_stage, "START JOB")
SortOrderType SortOrder
Definition: History.hh:146
STL namespace.
long CreationDate_NSec
Definition: History.hh:150
MDC Print()
ihistory DumpToTextFile(historyFile)
TList StageNames
Definition: History.hh:139
bool AscendingOrder
Definition: History.hh:147
TObjString FilePrefix
Definition: History.hh:143
wavearray< int > index
history AddHistory(job_stage, "WATVERSION", watversion('s'))
TList TypeNames
Definition: History.hh:140
Type
Definition: FrDisplay.cc:123
TList StageList
Definition: History.hh:142