BmnRoot
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
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
18class UniRawFile
19{
20 private:
21 /* GENERATED PRIVATE MEMBERS (SHOULD NOT BE CHANGED MANUALLY) */
23 UniConnection* connectionDB;
24
26 int i_file_id;
28 int i_period_number;
30 int i_run_number;
32 int i_start_event;
34 int i_end_event;
36 TDatime ts_start_datetime;
38 TDatime ts_end_datetime;
40 TString str_file_path;
42 int i_event_count;
44 int64_t i64_file_size;
46 TString* str_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
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);
80 static UniRawFile* GetRawFile(int file_id);
82 static UniRawFile* GetRawFile(TString file_path);
84 static int CheckRawFileExists(int file_id);
86 static int CheckRawFileExists(TString file_path);
88 static int DeleteRawFile(int file_id);
90 static int DeleteRawFile(TString file_path);
92 static int PrintAll();
93
94 // Getters
96 int GetFileId() { return i_file_id; }
98 int GetPeriodNumber() { return i_period_number; }
100 int GetRunNumber() { return i_run_number; }
102 int GetStartEvent() { return i_start_event; }
104 int GetEndEvent() { return i_end_event; }
106 TDatime GetStartDatetime() { return ts_start_datetime; }
108 TDatime GetEndDatetime() { return ts_end_datetime; }
110 TString GetFilePath() { return str_file_path; }
112 int GetEventCount() { return i_event_count; }
114 int64_t GetFileSize() { return i64_file_size; }
116 TString* GetFileHash()
117 {
118 if (str_file_hash == nullptr)
119 return nullptr;
120 else
121 return new TString(*str_file_hash);
122 }
123
124 // Setters
126 int SetPeriodNumber(int period_number);
128 int SetRunNumber(int run_number);
130 int SetStartEvent(int start_event);
132 int SetEndEvent(int end_event);
134 int SetStartDatetime(TDatime start_datetime);
136 int SetEndDatetime(TDatime end_datetime);
138 int SetFilePath(TString file_path);
140 int SetEventCount(int event_count);
142 int SetFileSize(int64_t file_size);
144 int SetFileHash(TString* file_hash);
145
147 void Print();
148 /* END OF PUBLIC GENERATED PART (SHOULD NOT BE CHANGED MANUALLY) */
149
153 static int CheckRawFileExists(int period_number, int run_number, int start_event, int end_event, bool strict_compare = false);
154
158 static int CheckRawFileExists(int period_number, int run_number, int start_event);
159
161 static int GetSumEventCount(int period_number, int run_number);
162
166 static TObjArray* GetRawFiles(int period_number, int run_number);
167
171 static TObjArray* GetRawFiles(int period_number, int run_number, int start_event, int end_event, bool strict_compare = true);
172
176 static TObjArray* GetRawFiles(TString path_part);
177
181 static TString CalculateFileHash(TString file_path);
182
184};
185
186#endif
static int CheckRawFileExists(int period_number, int run_number, int start_event, int end_event, bool strict_compare=false)
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
virtual ~UniRawFile()
ClassDef(UniRawFile, 1)
static TString CalculateFileHash(TString file_path)
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
static int PrintAll()
print all raw files
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
TDatime GetStartDatetime()
get start datetime of the current raw file
Definition UniRawFile.h:106
static int CheckRawFileExists(int period_number, int run_number, int start_event)
int SetFileHash(TString *file_hash)
set file hash of the current raw file
static int DeleteRawFile(TString file_path)
delete raw file from the database
static UniRawFile * GetRawFile(TString file_path)
get raw file from the database
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
static TObjArray * GetRawFiles(int period_number, int run_number)
int SetEventCount(int event_count)
set event count of the current raw file
static int CheckRawFileExists(int file_id)
check raw file exists in the database: 1- true, 0 - false, <0 - database operation error
int SetStartDatetime(TDatime start_datetime)
set start datetime of the current raw file
static int CheckRawFileExists(TString file_path)
check raw file exists in the database: 1- true, 0 - false, <0 - database operation error
int SetStartEvent(int start_event)
set start event of the current raw file
static int DeleteRawFile(int file_id)
delete raw file from the database
static UniRawFile * GetRawFile(int file_id)
get raw file from the database
TDatime GetEndDatetime()
get end datetime of the current raw file
Definition UniRawFile.h:108
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
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
int SetFilePath(TString file_path)
set file path of the current raw file
static TObjArray * GetRawFiles(int period_number, int run_number, int start_event, int end_event, bool strict_compare=true)
int GetEndEvent()
get end event of the current raw file
Definition UniRawFile.h:104
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
static TObjArray * GetRawFiles(TString path_part)
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
int SetPeriodNumber(int period_number)
set period number of the current raw file