BmnRoot 26.10.0-210-gc52d34b0
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
UniRawFile.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------
2// UniRawFile header file
3// Generated 27-09-2022
4// ----------------------------------------------------------------------
5
6/** /home/soul/bmnroot/database/uni_db1/UniRawFile.h
7 ** Class for the table: raw_file
8 **/
9
10#ifndef UNIRAWFILE_H
11#define UNIRAWFILE_H 1
12
13#include "TDatime.h"
14#include "TObjArray.h"
15#include "TString.h"
16#include "UniConnection.h"
17
19{
20 private:
21 /* GENERATED PRIVATE MEMBERS (SHOULD NOT BE CHANGED MANUALLY) */
22 /// connection to the database
24
25 /// file id
27 /// period number
29 /// run number
31 /// start event
33 /// end event
35 /// start datetime
37 /// end datetime
39 /// file path
41 /// event count
43 /// file size
45 /// file hash
47
48 // Constructor
49 UniRawFile(UniConnection* db_connect,
50 int file_id,
51 int period_number,
52 int run_number,
53 int start_event,
54 int end_event,
55 TDatime start_datetime,
56 TDatime end_datetime,
57 TString file_path,
58 int event_count,
59 int64_t file_size,
60 TString* file_hash);
61 /* END OF PRIVATE GENERATED PART (SHOULD NOT BE CHANGED MANUALLY) */
62
63 public:
64 /* GENERATED PUBLIC MEMBERS (SHOULD NOT BE CHANGED MANUALLY) */
65 virtual ~UniRawFile(); // Destructor
66
67 // static class functions
68 /// add new raw file to the database
69 static UniRawFile* CreateRawFile(int period_number,
70 int run_number,
71 int start_event,
72 int end_event,
73 TDatime start_datetime,
74 TDatime end_datetime,
75 TString file_path,
76 int event_count,
77 int64_t file_size,
78 TString* file_hash);
79 /// get raw file from the database
80 static UniRawFile* GetRawFile(int file_id);
81 /// get raw file from the database
82 static UniRawFile* GetRawFile(TString file_path);
83 /// check raw file exists in the database: 1- true, 0 - false, <0 - database operation error
84 static int CheckRawFileExists(int file_id);
85 /// check raw file exists in the database: 1- true, 0 - false, <0 - database operation error
86 static int CheckRawFileExists(TString file_path);
87 /// delete raw file from the database
88 static int DeleteRawFile(int file_id);
89 /// delete raw file from the database
90 static int DeleteRawFile(TString file_path);
91 /// print all raw files
92 static int PrintAll();
93
94 // Getters
95 /// get file id of the current raw file
96 int GetFileId() { return i_file_id; }
97 /// get period number of the current raw file
99 /// get run number of the current raw file
100 int GetRunNumber() { return i_run_number; }
101 /// get start event of the current raw file
102 int GetStartEvent() { return i_start_event; }
103 /// get end event of the current raw file
104 int GetEndEvent() { return i_end_event; }
105 /// get start datetime of the current raw file
107 /// get end datetime of the current raw file
109 /// get file path of the current raw file
111 /// get event count of the current raw file
112 int GetEventCount() { return i_event_count; }
113 /// get file size of the current raw file
114 int64_t GetFileSize() { return i64_file_size; }
115 /// get file hash of the current raw file
117 {
118 if (str_file_hash == nullptr)
119 return nullptr;
120 else
121 return new TString(*str_file_hash);
122 }
123
124 // Setters
125 /// set period number of the current raw file
126 int SetPeriodNumber(int period_number);
127 /// set run number of the current raw file
128 int SetRunNumber(int run_number);
129 /// set start event of the current raw file
130 int SetStartEvent(int start_event);
131 /// set end event of the current raw file
132 int SetEndEvent(int end_event);
133 /// set start datetime of the current raw file
134 int SetStartDatetime(TDatime start_datetime);
135 /// set end datetime of the current raw file
136 int SetEndDatetime(TDatime end_datetime);
137 /// set file path of the current raw file
138 int SetFilePath(TString file_path);
139 /// set event count of the current raw file
140 int SetEventCount(int event_count);
141 /// set file size of the current raw file
142 int SetFileSize(int64_t file_size);
143 /// set file hash of the current raw file
144 int SetFileHash(TString* file_hash);
145
146 /// print information about current raw file
147 void Print();
148 /* END OF PUBLIC GENERATED PART (SHOULD NOT BE CHANGED MANUALLY) */
149
150 /// check raw file exists in the database
151 /// for the given period_number:run_number and start_event-end_event values
152 /// returns 1 - true, 0 - false, <0 - database operation error
153 static int CheckRawFileExists(int period_number,
154 int run_number,
155 int start_event,
156 int end_event,
157 bool strict_compare = false);
158
159 /// check that raw file exists in the database
160 /// for the given period_number:run_number and start_event value
161 /// returns maximum 'end_event' value, 0 - not exists, <0 - database operation error
162 static int CheckRawFileExists(int period_number, int run_number, int start_event);
163
164 /// get event count for a given run as a sum for all raw files: if <0 - database operation error
165 static int GetSumEventCount(int period_number, int run_number);
166
167 /// get array of raw files (UniRawFile*) corresponding to the period:run number
168 /// ordered by start_event ascending
169 /// return nullptr if an error occured)
170 static TObjArray* GetRawFiles(int period_number, int run_number);
171
172 /// get array of raw files (UniRawFile*) corresponding to the period_number:run_number and start_event - end_event
173 /// ordered by file_id descending
174 /// returns nullptr if an error occured
175 static TObjArray* GetRawFiles(int period_number,
176 int run_number,
177 int start_event,
178 int end_event,
179 bool strict_compare = true);
180
181 /// get array of raw files (UniRawFile*) corresponding to a part of the file path, e.g. filename
182 /// ordered by file_id descending
183 /// return nullptr if an error occured)
184 static TObjArray* GetRawFiles(TString path_part);
185
186 /// calculate and return (in hex string format) cheсksum for a given file
187 /// use Adler32 algorithm if zlib library is found
188 /// or use MD5 algorithm if zlib library is not found
189 static TString CalculateFileHash(TString file_path);
190
192};
193
194#endif
#define ClassDef(name, id)
/home/soul/bmnroot/database/uni_db1/UniRawFile.h Class for the table: raw_file
Definition UniRawFile.h:19
int64_t GetFileSize()
get file size of the current raw file
Definition UniRawFile.h:114
int GetEventCount()
get event count of the current raw file
Definition UniRawFile.h:112
TString str_file_path
file path
Definition UniRawFile.h:40
static int PrintAll()
print all raw files
TString * str_file_hash
file hash
Definition UniRawFile.h:46
int i_start_event
start event
Definition UniRawFile.h:32
int SetFileSize(int64_t file_size)
set file size of the current raw file
TString GetFilePath()
get file path of the current raw file
Definition UniRawFile.h:110
void Print()
print information about current raw file
int SetEndDatetime(TDatime end_datetime)
set end datetime of the current raw file
int GetRunNumber()
get run number of the current raw file
Definition UniRawFile.h:100
UniConnection * connectionDB
connection to the database
Definition UniRawFile.h:23
TDatime GetStartDatetime()
get start datetime of the current raw file
Definition UniRawFile.h:106
int SetFileHash(TString *file_hash)
set file hash of the current raw file
int i_end_event
end event
Definition UniRawFile.h:34
static int GetSumEventCount(int period_number, int run_number)
get event count for a given run as a sum for all raw files: if <0 - database operation error
static UniRawFile * GetRawFile(int file_id)
get raw file from the database
static int CheckRawFileExists(int file_id)
check raw file exists in the database: 1- true, 0 - false, <0 - database operation error
TString * GetFileHash()
get file hash of the current raw file
Definition UniRawFile.h:116
int SetRunNumber(int run_number)
set run number of the current raw file
int SetEventCount(int event_count)
set event count of the current raw file
int SetStartDatetime(TDatime start_datetime)
set start datetime of the current raw file
int SetStartEvent(int start_event)
set start event of the current raw file
UniRawFile(UniConnection *db_connect, int file_id, int period_number, int run_number, int start_event, int end_event, TDatime start_datetime, TDatime end_datetime, TString file_path, int event_count, int64_t file_size, TString *file_hash)
TDatime GetEndDatetime()
get end datetime of the current raw file
Definition UniRawFile.h:108
static UniRawFile * CreateRawFile(int period_number, int run_number, int start_event, int end_event, TDatime start_datetime, TDatime end_datetime, TString file_path, int event_count, int64_t file_size, TString *file_hash)
add new raw file to the database
virtual ~UniRawFile()
int SetEndEvent(int end_event)
set end event of the current raw file
int GetFileId()
get file id of the current raw file
Definition UniRawFile.h:96
int i_period_number
period number
Definition UniRawFile.h:28
int SetFilePath(TString file_path)
set file path of the current raw file
int i_file_id
file id
Definition UniRawFile.h:26
int i_event_count
event count
Definition UniRawFile.h:42
TDatime ts_end_datetime
end datetime
Definition UniRawFile.h:38
TDatime ts_start_datetime
start datetime
Definition UniRawFile.h:36
int GetEndEvent()
get end event of the current raw file
Definition UniRawFile.h:104
static TObjArray * GetRawFiles(int period_number, int run_number)
get array of raw files (UniRawFile*) corresponding to the period:run number ordered by start_event as...
static int DeleteRawFile(int file_id)
delete raw file from the database
int i_run_number
run number
Definition UniRawFile.h:30
static TString CalculateFileHash(TString file_path)
calculate and return (in hex string format) cheсksum for a given file use Adler32 algorithm if zlib l...
int GetPeriodNumber()
get period number of the current raw file
Definition UniRawFile.h:98
int GetStartEvent()
get start event of the current raw file
Definition UniRawFile.h:102
int64_t i64_file_size
file size
Definition UniRawFile.h:44
int SetPeriodNumber(int period_number)
set period number of the current raw file