BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
EventCatalogue Class Reference

Main Interface Class to work with the Event Catalogue of the experiment Throws runtime_exception if a critical error occurrs while the constructor Error Codes: -1 - sending command via CURL failed, -401 - unauthorized request, -403 - token invalid or expired, -404 - data not found, -409 - incorrect database request (e.g. More...

#include <EventCatalogue.h>

Public Member Functions

 EventCatalogue ()
virtual ~EventCatalogue ()
vector< unique_ptr< EventInfo > > GetEventList (vector< unique_ptr< EventCondition > > event_conditions)
 Function for searching for event metadata in the Event Catalogue using specified conditions.
unique_ptr< EventInfo > GetEventInfo (string storage_name, string file_path, int event_number)
 Function tp get metadata of the event stored at the given location.
int AddEventInfo (string storage_name, string file_path, int event_number, EventInfo event_metadata)
 Function to add metadata for the event stored at the given location.
int AddEventInfo (string json_file_path)
 Function to add metadata of events to the Event Catalogue using input JSON file path.
int UpdateEventInfo (string storage_name, string file_path, int event_number, EventInfo event_metadata)
 Function to update metadata of the event stored at the given location.
int DeleteEventInfo (string storage_name, string file_path, int event_number)
 Function to delete metadata for the event stored at the given location.
int CheckEventInfo (string storage_name, string file_path, int event_number)
 Function to check metadata for the event stored at the given location.
int PrintEventInfo (string storage_name, string file_path, int event_number)
 Function to print metadata for the event stored at the given location.
int AddStorageInfo (string storage_name)
 Function to add storage to the dictionary used by the Event Catalogue.
int AddSoftwareInfo (string software_version)
 Function to add software version to the dictionary used by the Event Catalogue.
vector< unique_ptr< EventInfo > > EventCatalogueRequest (string rest_api_request)
 Function for searching for event metadata in the Event Catalogue using REST API request as an HTTP(s) string.
int EventCatalogueChecks (int &file_not_found, vector< unique_ptr< EventInfo > > &event_list)
 Function to perform a set of specific checks in the Event Catalogue.
int EventCatalogueStats (int &record_count)
 Function to collect summary statistics on the Event Catalogue.
void SetVerbose (int verbose_level=2)
 Setting Verbose level: 0 - only errors, 1 - normal output, 2 - detailed output, 2- all with debug info.
 EventCatalogue ()
virtual ~EventCatalogue ()
vector< unique_ptr< EventInfo > > GetEventList (vector< unique_ptr< EventCondition > > event_conditions)
 Function for searching for event metadata in the Event Catalogue using specified conditions.
unique_ptr< EventInfo > GetEventInfo (string storage_name, string file_path, int event_number)
 Function tp get metadata of the event stored at the given location.
int AddEventInfo (string storage_name, string file_path, int event_number, EventInfo event_metadata)
 Function to add metadata for the event stored at the given location.
int AddEventInfo (string json_file_path)
 Function to add metadata of events to the Event Catalogue using input JSON file path.
int UpdateEventInfo (string storage_name, string file_path, int event_number, EventInfo event_metadata)
 Function to update metadata of the event stored at the given location.
int DeleteEventInfo (string storage_name, string file_path, int event_number)
 Function to delete metadata for the event stored at the given location.
int CheckEventInfo (string storage_name, string file_path, int event_number)
 Function to check metadata for the event stored at the given location.
int PrintEventInfo (string storage_name, string file_path, int event_number)
 Function to print metadata for the event stored at the given location.
int AddStorageInfo (string storage_name)
 Function to add storage to the dictionary used by the Event Catalogue.
int AddSoftwareInfo (string software_version)
 Function to add software version to the dictionary used by the Event Catalogue.
vector< unique_ptr< EventInfo > > EventCatalogueRequest (string rest_api_request)
 Function for searching for event metadata in the Event Catalogue using REST API request as an HTTP(s) string.
int EventCatalogueChecks (int &file_not_found, vector< unique_ptr< EventInfo > > &event_list)
 Function to perform a set of specific checks in the Event Catalogue.
int EventCatalogueStats (int &record_count)
 Function to collect summary statistics on the Event Catalogue.
void SetVerbose (int verbose_level=2)
 Setting Verbose level: 0 - only errors, 1 - normal output, 2 - detailed output, 2- all with debug info.

Private Member Functions

int PostRequest (string RequestUrl, string json_string, string success_message)
int PostRequest (string RequestUrl, string json_string, string success_message)

Private Attributes

CURL * curlInstance
string ServiceUrl
string ServiceAccount
int VerboseLevel = 2

Detailed Description

violating constraints), -422 - incorrect input request, -500 - internal server error, -503 - service unavaialble, -504 - gateway timeout

Definition at line 97 of file EventCatalogue.h.

Constructor & Destructor Documentation

◆ EventCatalogue() [1/2]

◆ ~EventCatalogue() [1/2]

EventCatalogue::~EventCatalogue ( )
virtual

Definition at line 88 of file EventCatalogue.cxx.

References curlInstance.

◆ EventCatalogue() [2/2]

EventCatalogue::EventCatalogue ( )

◆ ~EventCatalogue() [2/2]

virtual EventCatalogue::~EventCatalogue ( )
virtual

Member Function Documentation

◆ AddEventInfo() [1/4]

int EventCatalogue::AddEventInfo ( string json_file_path)
Parameters
[in]json_file_pathpath of the JSON file containing a set of event metadata to be stored
Returns
number (>=0) of successfully added event metadata records or error_code (<0) in case of failures

Definition at line 143 of file EventCatalogue.cxx.

References PostRequest(), ServiceUrl, and VerboseLevel.

Here is the call graph for this function:

◆ AddEventInfo() [2/4]

int EventCatalogue::AddEventInfo ( string json_file_path)
Parameters
[in]json_file_pathpath of the JSON file containing a set of event metadata to be stored
Returns
number (>=0) of successfully added event metadata records or error_code (<0) in case of failures

◆ AddEventInfo() [3/4]

int EventCatalogue::AddEventInfo ( string storage_name,
string file_path,
int event_number,
EventInfo event_metadata )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
[in]event_metadata'EventInfo' object containing event metadata for the event
Returns
0 - if successfully added, <0 - an error occured

Definition at line 110 of file EventCatalogue.cxx.

Referenced by write_emd().

Here is the caller graph for this function:

◆ AddEventInfo() [4/4]

int EventCatalogue::AddEventInfo ( string storage_name,
string file_path,
int event_number,
EventInfo event_metadata )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
[in]event_metadata'EventInfo' object containing event metadata for the event
Returns
0 - if successfully added, <0 - an error occured

◆ AddSoftwareInfo() [1/2]

int EventCatalogue::AddSoftwareInfo ( string software_version)
Parameters
[in]software_versionVersion of the software, which was used to obtain processed events
Returns
0 - if successfull, <0 - an error occured

Definition at line 203 of file EventCatalogue.cxx.

References PostRequest(), ServiceUrl, and VerboseLevel.

Here is the call graph for this function:

◆ AddSoftwareInfo() [2/2]

int EventCatalogue::AddSoftwareInfo ( string software_version)
Parameters
[in]software_versionVersion of the software, which was used to obtain processed events
Returns
0 - if successfull, <0 - an error occured

◆ AddStorageInfo() [1/2]

int EventCatalogue::AddStorageInfo ( string storage_name)
Parameters
[in]storage_nameName of the storage be added to the dictionary
Returns
0 - if successfull, <0 - an error occured

Definition at line 187 of file EventCatalogue.cxx.

References PostRequest(), ServiceUrl, and VerboseLevel.

Here is the call graph for this function:

◆ AddStorageInfo() [2/2]

int EventCatalogue::AddStorageInfo ( string storage_name)
Parameters
[in]storage_nameName of the storage be added to the dictionary
Returns
0 - if successfull, <0 - an error occured

◆ CheckEventInfo() [1/2]

int EventCatalogue::CheckEventInfo ( string storage_name,
string file_path,
int event_number )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
Returns
0 - if event metadata is avaialble, 1 - if event metadata is not set, <0 - an error occured

Definition at line 173 of file EventCatalogue.cxx.

◆ CheckEventInfo() [2/2]

int EventCatalogue::CheckEventInfo ( string storage_name,
string file_path,
int event_number )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
Returns
0 - if event metadata is avaialble, 1 - if event metadata is not set, <0 - an error occured

◆ DeleteEventInfo() [1/2]

int EventCatalogue::DeleteEventInfo ( string storage_name,
string file_path,
int event_number )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
Returns
0 - if successfully deleted, <0 - an error occured

Definition at line 166 of file EventCatalogue.cxx.

◆ DeleteEventInfo() [2/2]

int EventCatalogue::DeleteEventInfo ( string storage_name,
string file_path,
int event_number )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
Returns
0 - if successfully deleted, <0 - an error occured

◆ EventCatalogueChecks() [1/2]

int EventCatalogue::EventCatalogueChecks ( int & file_not_found,
vector< unique_ptr< EventInfo > > & event_list )
Parameters
[out]file_not_foundNumber of not found files for existing metadata in the Catalogue
[out]event_listList of not found files for existing metadata in the Catalogue
Returns
0 - if successfull, <0 - an error occured

Definition at line 228 of file EventCatalogue.cxx.

◆ EventCatalogueChecks() [2/2]

int EventCatalogue::EventCatalogueChecks ( int & file_not_found,
vector< unique_ptr< EventInfo > > & event_list )
Parameters
[out]file_not_foundNumber of not found files for existing metadata in the Catalogue
[out]event_listList of not found files for existing metadata in the Catalogue
Returns
0 - if successfull, <0 - an error occured

◆ EventCatalogueRequest() [1/2]

vector< unique_ptr< EventInfo > > EventCatalogue::EventCatalogueRequest ( string rest_api_request)
Parameters
[in]rest_api_requestString HTTP command representing a request using REST API format
Returns
Array of the 'EventInfo' objects containing selected event metadata (enpty if not found or some errors occured)

Definition at line 220 of file EventCatalogue.cxx.

◆ EventCatalogueRequest() [2/2]

vector< unique_ptr< EventInfo > > EventCatalogue::EventCatalogueRequest ( string rest_api_request)
Parameters
[in]rest_api_requestString HTTP command representing a request using REST API format
Returns
Array of the 'EventInfo' objects containing selected event metadata (enpty if not found or some errors occured)

◆ EventCatalogueStats() [1/2]

int EventCatalogue::EventCatalogueStats ( int & record_count)
Parameters
[out]record_countNumber of records in the Event Catalogue
Returns
0 - if successfull, <0 - an error occured

Definition at line 235 of file EventCatalogue.cxx.

◆ EventCatalogueStats() [2/2]

int EventCatalogue::EventCatalogueStats ( int & record_count)
Parameters
[out]record_countNumber of records in the Event Catalogue
Returns
0 - if successfull, <0 - an error occured

◆ GetEventInfo() [1/2]

unique_ptr< EventInfo > EventCatalogue::GetEventInfo ( string storage_name,
string file_path,
int event_number )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
Returns
'EventInfo' object containing event metadata for the event (nullptr if not found or some errors occured)

Definition at line 102 of file EventCatalogue.cxx.

◆ GetEventInfo() [2/2]

unique_ptr< EventInfo > EventCatalogue::GetEventInfo ( string storage_name,
string file_path,
int event_number )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
Returns
'EventInfo' object containing event metadata for the event (nullptr if not found or some errors occured)

◆ GetEventList() [1/2]

vector< unique_ptr< EventInfo > > EventCatalogue::GetEventList ( vector< unique_ptr< EventCondition > > event_conditions)
Parameters
[in]event_conditionsA set of conditions to specify criteria for event metadata search
Returns
Array of the 'EventInfo' objects containing selected event metadata (enpty if not found or some errors occured)

Definition at line 94 of file EventCatalogue.cxx.

◆ GetEventList() [2/2]

vector< unique_ptr< EventInfo > > EventCatalogue::GetEventList ( vector< unique_ptr< EventCondition > > event_conditions)
Parameters
[in]event_conditionsA set of conditions to specify criteria for event metadata search
Returns
Array of the 'EventInfo' objects containing selected event metadata (enpty if not found or some errors occured)

◆ PostRequest() [1/2]

int EventCatalogue::PostRequest ( string RequestUrl,
string json_string,
string success_message )
private

Definition at line 242 of file EventCatalogue.cxx.

References curlInstance, GetErrorString(), header_callback(), response_callback(), ServiceAccount, and VerboseLevel.

Referenced by AddEventInfo(), AddSoftwareInfo(), and AddStorageInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PostRequest() [2/2]

int EventCatalogue::PostRequest ( string RequestUrl,
string json_string,
string success_message )
private

◆ PrintEventInfo() [1/2]

int EventCatalogue::PrintEventInfo ( string storage_name,
string file_path,
int event_number )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
Returns
0 - if successfull, <0 - an error occured

Definition at line 180 of file EventCatalogue.cxx.

◆ PrintEventInfo() [2/2]

int EventCatalogue::PrintEventInfo ( string storage_name,
string file_path,
int event_number )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
Returns
0 - if successfull, <0 - an error occured

◆ SetVerbose() [1/2]

void EventCatalogue::SetVerbose ( int verbose_level = 2)
inline
Parameters
[in]verbose_levelVerbose level for output information

Definition at line 215 of file EventCatalogue.h.

References VerboseLevel.

◆ SetVerbose() [2/2]

void EventCatalogue::SetVerbose ( int verbose_level = 2)
inline
Parameters
[in]verbose_levelVerbose level for output information

Definition at line 215 of file EventCatalogue.h.

References VerboseLevel.

◆ UpdateEventInfo() [1/2]

int EventCatalogue::UpdateEventInfo ( string storage_name,
string file_path,
int event_number,
EventInfo event_metadata )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
[in]event_metadata'EventInfo' object containing event metadata for the event
Returns
0 - if successfully updated, <0 - an error occured

Definition at line 159 of file EventCatalogue.cxx.

◆ UpdateEventInfo() [2/2]

int EventCatalogue::UpdateEventInfo ( string storage_name,
string file_path,
int event_number,
EventInfo event_metadata )
Parameters
[in]storage_nameStorage, where the file with the event is located
[in]file_pathPath of the file containing the event
[in]event_numberNumber of the event in the file
[in]event_metadata'EventInfo' object containing event metadata for the event
Returns
0 - if successfully updated, <0 - an error occured

Member Data Documentation

◆ curlInstance

CURL * EventCatalogue::curlInstance
private

Definition at line 218 of file EventCatalogue.h.

Referenced by EventCatalogue(), ~EventCatalogue(), and PostRequest().

◆ ServiceAccount

string EventCatalogue::ServiceAccount
private

Definition at line 220 of file EventCatalogue.h.

Referenced by EventCatalogue(), and PostRequest().

◆ ServiceUrl

string EventCatalogue::ServiceUrl
private

Definition at line 219 of file EventCatalogue.h.

Referenced by EventCatalogue(), AddEventInfo(), AddSoftwareInfo(), and AddStorageInfo().

◆ VerboseLevel

int EventCatalogue::VerboseLevel = 2
private

The documentation for this class was generated from the following files: