BmnRoot
Loading...
Searching...
No Matches
UniDetectorParameter.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------
2// UniDetectorParameter header file
3// ----------------------------------------------------------------------
4
9#ifndef UniDetectorPARAMETER_H
10#define UniDetectorPARAMETER_H 1
11
12#include "TDatime.h"
13#include "TObjArray.h"
14#include "TString.h"
15#include "UniConnection.h"
16#include "UniParameter.h"
17#include "UniSearchCondition.h"
18
19#include <iostream>
20using namespace std;
21
23{
24 private:
25 /* GENERATED PRIVATE MEMBERS (SHOULD NOT BE CHANGED MANUALLY) */
27 UniConnection* connectionDB;
28
30 int i_value_id;
32 TString str_detector_name;
34 int i_parameter_id;
36 int i_start_period;
38 int i_start_run;
40 int i_end_period;
42 int i_end_run;
44 int i_value_key;
46 unsigned char* blob_parameter_value;
48 Long_t sz_parameter_value;
50 TDatime* ts_expiry_date;
51
52 // Constructor
54 int value_id,
55 TString detector_name,
56 int parameter_id,
57 int start_period,
58 int start_run,
59 int end_period,
60 int end_run,
61 int value_key,
62 unsigned char* parameter_value,
63 Long_t size_parameter_value,
64 TDatime* expiry_date);
65 /* END OF PRIVATE GENERATED PART (SHOULD NOT BE CHANGED MANUALLY) */
66
67 public:
68 /* GENERATED PUBLIC MEMBERS (SHOULD NOT BE CHANGED MANUALLY) */
69 virtual ~UniDetectorParameter(); // Destructor
70
71 // static class functions
73 static UniDetectorParameter* CreateDetectorParameter(TString detector_name,
74 int parameter_id,
75 int start_period,
76 int start_run,
77 int end_period,
78 int end_run,
79 int value_key,
80 unsigned char* parameter_value,
81 Long_t size_parameter_value,
82 TDatime* expiry_date);
84 static UniDetectorParameter* GetDetectorParameter(int value_id);
86 static int CheckDetectorParameterExists(int value_id);
88 static int DeleteDetectorParameter(int value_id);
90 static int PrintAll();
91
92 // Getters
94 int GetValueId() { return i_value_id; }
96 TString GetDetectorName() { return str_detector_name; }
98 int GetParameterId() { return i_parameter_id; }
100 int GetStartPeriod() { return i_start_period; }
102 int GetStartRun() { return i_start_run; }
104 int GetEndPeriod() { return i_end_period; }
106 int GetEndRun() { return i_end_run; }
108 int GetValueKey() { return i_value_key; }
110 unsigned char* GetParameterValue()
111 {
112 unsigned char* tmp_parameter_value = new unsigned char[sz_parameter_value];
113 memcpy(tmp_parameter_value, blob_parameter_value, sz_parameter_value);
114 return tmp_parameter_value;
115 }
117 Long_t GetParameterValueSize() { return sz_parameter_value; }
119 TDatime* GetExpiryDate()
120 {
121 if (ts_expiry_date == nullptr)
122 return nullptr;
123 else
124 return new TDatime(*ts_expiry_date);
125 }
126
127 // Setters
129 int SetDetectorName(TString detector_name);
131 int SetParameterId(int parameter_id);
133 int SetStartPeriod(int start_period);
135 int SetStartRun(int start_run);
137 int SetEndPeriod(int end_period);
139 int SetEndRun(int end_run);
141 int SetValueKey(int value_key);
143 int SetParameterValue(unsigned char* parameter_value, Long_t size_parameter_value);
145 int SetExpiryDate(TDatime* expiry_date);
146
148 void Print();
149 /* END OF PUBLIC GENERATED PART (SHOULD NOT BE CHANGED MANUALLY) */
150
152 static UniDetectorParameter* CreateDetectorParameter(TString detector_name,
153 TString parameter_name,
154 int start_period,
155 int start_run,
156 int end_period,
157 int end_run,
158 vector<UniValue*> parameter_value,
159 int value_key = 0);
161 static UniDetectorParameter* CreateDetectorParameter(TString detector_name,
162 TString parameter_name,
163 int start_period,
164 int start_run,
165 int end_period,
166 int end_run,
167 UniValue* parameter_value,
168 int value_key = 0);
169
171 static UniDetectorParameter* GetDetectorParameter(TString detector_name,
172 TString parameter_name,
173 int period_number,
174 int run_number,
175 TDatime* usage_time = nullptr,
176 int value_key = 0);
177
179 static int DeleteDetectorParameter(TString detector_name,
180 TString parameter_name,
181 int start_period,
182 int start_run,
183 int end_period,
184 int end_run,
185 TDatime* usage_time,
186 int value_key = 0);
187
189 int GetValue(vector<UniValue*>& parameter_value);
193 int SetValue(vector<UniValue*> parameter_value);
195 int SetValue(UniValue* parameter_value);
196
199 static int WriteFile(const char* detector_name,
200 const char* parameter_name,
201 int start_period,
202 int start_run,
203 int end_period,
204 int end_run,
205 const char* file_path);
208 static int ReadFile(const char* detector_name,
209 const char* parameter_name,
210 int period_number,
211 int run_number,
212 const char* file_path);
213
216 static TObjArray* Search(UniSearchCondition& search_condition);
219 static TObjArray* Search(TObjArray& search_conditions);
220
222 TString GetParameterName();
225
227 void GetStart(int& start_period, int& start_run);
229 void GetEnd(int& end_period, int& end_run);
231 int SetStart(int start_period, int start_run);
233 int SetEnd(int end_period, int end_run);
234
245 // static int ParseTxt(TString text_file, TString detector_name, TString parameter_name, int start_period, int
246 // start_run, int end_period, int end_run);
247
248 protected:
249 // non-user function for getting parameter value as a binary (char) array
250 unsigned char* GetUNC(enumValueType enum_parameter_type = UndefinedType);
251
252 // non-user function for setting parameter value as a binary (char) array
253 int SetUNC(unsigned char* p_parameter_value, Long_t size_parameter_value);
254
255 // non-user function for writing parameter value (integer value key is optional, default, 0)
256 static UniDetectorParameter* CreateDetectorParameter(TString detector_name,
257 TString parameter_name,
258 int start_period,
259 int start_run,
260 int end_period,
261 int end_run,
262 unsigned char* parameter_value,
263 Long_t size_parameter_value,
264 enumValueType enum_parameter_type,
265 int value_key = 0);
266
268};
269
270#endif
Long_t GetParameterValueSize()
get size of parameter value of the current detector parameter
int SetStart(int start_period, int start_run)
set start period and run of the current parameter value
int SetValue(vector< UniValue * > parameter_value)
set value to detector parameter presented by an array
enumValueType GetParameterType()
get parameter type of the current parameter value
int SetValueKey(int value_key)
set value key of the current detector parameter
int SetDetectorName(TString detector_name)
set detector name of the current detector parameter
void GetStart(int &start_period, int &start_run)
get start period and run of the current parameter value
int GetStartPeriod()
get start period of the current detector parameter
int SetExpiryDate(TDatime *expiry_date)
set expiry date of the current detector parameter
TString GetParameterName()
get parameter name of the current parameter value
void GetEnd(int &end_period, int &end_run)
get end period and run of the current parameter value
UniValue * GetValue()
get value of detector parameter presented by a single value
int SetEnd(int end_period, int end_run)
set end period and run of the current parameter value
unsigned char * GetParameterValue()
get parameter value of the current detector parameter
TDatime * GetExpiryDate()
get expiry date of the current detector parameter
static int DeleteDetectorParameter(int value_id)
delete detector parameter from the database
int SetParameterId(int parameter_id)
set parameter id of the current detector parameter
static TObjArray * Search(UniSearchCondition &search_condition)
ClassDef(UniDetectorParameter, 1)
int SetEndPeriod(int end_period)
set end period of the current detector parameter
static int WriteFile(const char *detector_name, const char *parameter_name, int start_period, int start_run, int end_period, int end_run, const char *file_path)
TString GetDetectorName()
get detector name of the current detector parameter
int GetParameterId()
get parameter id of the current detector parameter
int SetEndRun(int end_run)
set end run of the current detector parameter
int SetStartRun(int start_run)
set start run of the current detector parameter
int GetEndPeriod()
get end period of the current detector parameter
void Print()
print information about current detector parameter
int SetUNC(unsigned char *p_parameter_value, Long_t size_parameter_value)
int GetEndRun()
get end run of the current detector parameter
static int PrintAll()
print all detector parameters
int GetValueId()
get value id of the current detector parameter
int SetStartPeriod(int start_period)
set start period of the current detector parameter
static UniDetectorParameter * GetDetectorParameter(int value_id)
get detector parameter from the database
static int CheckDetectorParameterExists(int value_id)
check detector parameter exists in the database: 1- true, 0 - false, <0 - database operation error
static int ReadFile(const char *detector_name, const char *parameter_name, int period_number, int run_number, const char *file_path)
int GetValueKey()
get value key of the current detector parameter
int GetStartRun()
get start run of the current detector parameter
static UniDetectorParameter * CreateDetectorParameter(TString detector_name, int parameter_id, int start_period, int start_run, int end_period, int end_run, int value_key, unsigned char *parameter_value, Long_t size_parameter_value, TDatime *expiry_date)
add new detector parameter to the database
int SetParameterValue(unsigned char *parameter_value, Long_t size_parameter_value)
set parameter value of the current detector parameter
unsigned char * GetUNC(enumValueType enum_parameter_type=UndefinedType)
enumValueType
@ UndefinedType
STL namespace.