Logo coherent WaveBurst  
Library Reference Guide
Logo
HistoryStage.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  HistoryStage.h - description
21  -------------------
22  begin : ven set 2 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 HISTORYSTAGE_H
37 #define HISTORYSTAGE_H
38 
39 #include "TObject.h"
40 #include "TDatime.h"
41 #include "TList.h"
42 #include "TString.h"
43 //#include "AalException.h"
44 #include "HistoryDefines.hh"
45 #include "TTimeStamp.h"
46 #include "TSystem.h"
47 #include <stdlib.h>
48 #include <iostream>
49 #include <fstream>
50 
51 using namespace std;
52 
53 namespace CWB {
54 
55 class HistoryStage : public TObject {
56 public:
57  HistoryStage(char** HistoryTypes = NULL, int TypeNumber = 0, char* Name = NULL, char* Comment = NULL, TDatime* Time = NULL);
58  HistoryStage(const TList& HistoryTypes, char* Name = NULL, char* Comemment = NULL, TDatime* Time = NULL);
59  HistoryStage(char** HistoryTypes, int TypeNumber, char* Name, char* Comment, int Date, int Time);
60  HistoryStage(const TList& HistoryTypes, char* Name, char* Comment, int Date, int Time);
62  ~HistoryStage();
63 
64  char* SetName(char* Name);
65  char* SetComment(char* Comment);
66  void SetTime(TDatime* Time);
67  void SetTime(int Date, int Time);
68  void SetTypes(char** HistoryTypes, int TypeNumber);
69  char* SetTypeComment(char* Type, char* Comment);
70 
71  char* GetName();
72  char* GetComment();
73  int GetDate();
74  int GetTime();
75  TDatime*GetDatime();
76  char* GetTypeComment(char* Type);
77 
78  void AddLog(char* LogMsg, TDatime* Time = NULL);
79  void AddLog(char* LogMsg, int Date, int Time);
80 
81  void AddHistory(char* Type, char* History, char* Comment = NULL, bool Replace = false);
82 
83  int GetHistorySize();
84  int GetLogSize();
85  char* GetHistoryEntry(int index);
86  char* GetHistoryEntryType(int index);
87  char* GetLogEntry(int index);
88  int GetLogEntryDate(int index);
89  int GetLogEntryTime(int index);
90  TDatime* GetLogEntryDatime(int index);
91 
92  char* GetHistory(char* Type);
93 
94  void SortLogs(bool Ascending = true);
95 
96  bool TypeAllowed(char* Type);
97  bool TypeAlreadyPresent(char* Type);
98 
99  virtual void Browse(TBrowser *b);
100  void Print();
101 
102  bool IsSortable() const;
103  int Compare(const TObject* Obj) const;
104 
105  char* AddType(char* TypeName);
106  char* RemoveType(char* TypeName);
107 
108  SortOrderType SetSortOrder(SortOrderType SortOrder);
109  SortOrderType GetSortOrder();
110 
111  bool IsSortOrderInsertion();
112  bool IsSortOrderDate();
113  bool IsSortOrderAlphabetical();
114 
115  bool SetAscendingSortOrder();
116  bool SetDescendantSortOrder();
117 
118  bool GetAscendingSortOrder();
119  bool GetDescendantSortOrder();
120 
121  void Sort();
122 
123  TTimeStamp GetCreationTimeStamp();
124 
125  void HistoryStageException(int type, const char *location, const char *msgfmt, ...);
126 
127 private:
128  int Date;
129  int Time;
130 
132 
133  int NameLength; //Name char number + 1
134  char* Name; //[NameLength]
135 
136  TList History;
137  TList Logs;
138 
139  int CommentLength; //Comment char number + 1
140  char* Comment; //[CommentLength]
141 
144 
147 
148  void Init();
149  void Destroy();
150  void NameSet(char* Name);
151  void CommentSet(char* Comment);
152 
153  ClassDef(HistoryStage, 3)
154 };
155 
156 } // end namespace
157 
158 #endif
void Init()
Definition: ChirpMass.C:284
Definition: ced.hh:42
plot hist2D SetName("WSeries-1")
SortOrderType
history AddLog(job_stage, "START JOB")
STL namespace.
MDC Print()
SortOrderType SortOrder
wavearray< int > index
history AddHistory(job_stage, "WATVERSION", watversion('s'))
Type
Definition: FrDisplay.cc:123