![]() |
ATLAS Offline Software
|
It compares timestamp in string format. More...
#include <CrestContainer.h>
Public Member Functions | |
CrestContainer (ModeId mode=ModeId::Standard) | |
Constructor of CrestContainer. More... | |
~CrestContainer () | |
Destructor of CrestContainer. More... | |
void | addColumn (const std::string &name, TypeId type) |
It adds a column to the payload specification. More... | |
void | addColumn (const std::string &name, const std::string &type) |
It adds a column to the payload specification. More... | |
bool | isVectorPayload () |
It sets the Vector mode of the container. More... | |
void | setVectorPayload (bool isVectorPayload) |
Set the Vectore mode of the container. More... | |
void | putRow2Vector () |
It adds row data to vector. More... | |
void | addNullRecord (const std::string &name) |
It adds a null value to the payload. More... | |
void | addRecord (const std::string &name, int number,...) |
It adds a record to the payload. More... | |
void | addData (const std::string &channel_id) |
It associate the payload row to a channel_id. More... | |
void | addExternalData (const std::string &channel_id, const nlohmann::json &data) |
It associate the payload row to a channel_id. More... | |
void | addIov (const uint64_t since) |
It adds an IOV to the json object m_iov_data. More... | |
const std::vector< std::pair< std::string, TypeId > > & | getMPayloadSpec () |
Return tag specification in vector format. More... | |
const nlohmann::json & | getPayload () |
Return current payload in json format. More... | |
const nlohmann::json & | getIovData () |
Return selected IOV in json format. More... | |
const nlohmann::json | getPayloadChannel (const std::string &channel_id) |
Return payload in json format for selected channel id. More... | |
nlohmann::json | getPayloadSpec () |
Return payload specification in json format. More... | |
int | getColumnIndex (const std::string &name) |
It returns the index of the column with the given name. More... | |
void | flush () |
It reinitializes the containers. More... | |
void | clear () |
It clear data the container. More... | |
void | selectIov (const uint64_t since) |
It select timestamp as active. More... | |
std::vector< std::string > | channelIds () |
Return list of channel id in string format. More... | |
std::string | getJsonPayload () |
It returns the json representation of the container. More... | |
std::string | getJsonIovData () |
It returns the json representation of the container. More... | |
void | dumpJsonToFile (const nlohmann::json &j, const std::string &filename) |
It creates a file with the json representation of the container. More... | |
nlohmann::json | readJsonFromFile (const std::string &filename, const std::string &spec_filename) |
It reads a json file and returns the json object. More... | |
std::vector< uint64_t > | fromJson (uint64_t since, const nlohmann::json &j) |
It reads a json object to fill the container. More... | |
nlohmann::json | getStoreSetDto (uint64_t period=-1) |
It return StoreSetDto in json format. More... | |
uint64_t | getFirstTime () |
It return minimal timestamp in concainer. More... | |
void | parseData (const nlohmann::json &values) |
It reads a json object, parse it and fill the container. More... | |
Private Member Functions | |
nlohmann::json | createRowArray (const nlohmann::json &data_row) const |
const nlohmann::json & | getRow () |
void | parseOldFormat (const std::string &colName, const TypeId &typespec, const nlohmann::json &j) |
void | readCommonType (uint64_t since, const nlohmann::json &j_in) |
std::vector< uint64_t > | readDcsFullType (const nlohmann::json &j_in) |
void | setIovData (const nlohmann::json &j) |
void | setPayload (const nlohmann::json &j) |
void | setPayloadSpec (const nlohmann::json &j) |
Private Attributes | |
std::vector< std::pair< std::string, TypeId > > | m_payload_spec |
nlohmann::json | m_payload ={} |
nlohmann::json | m_row ={} |
nlohmann::json | m_iov_data ={} |
nlohmann::json | m_vector_data =nlohmann::json::array() |
std::map< uint64_t, nlohmann::json > | m_full_data |
ModeId | m_modeId |
bool | m_isVectorPayload =false |
It compares timestamp in string format.
Definition at line 58 of file CrestContainer.h.
Crest::CrestContainer::CrestContainer | ( | Crest::ModeId | mode = ModeId::Standard | ) |
Constructor of CrestContainer.
mode | Set mode of data. In current moment support two mode: Standard (default mode) and DCS_FULL (DCS mode with full data for each timestamp) |
Definition at line 13 of file CrestContainer.cxx.
Crest::CrestContainer::~CrestContainer | ( | ) |
Destructor of CrestContainer.
Definition at line 14 of file CrestContainer.cxx.
It adds a column to the payload specification.
name | The name of the column. |
type | The type of the column in string format. |
This method adds a column to the payload specification. filling the vector m_payload_spec. The methods with a different signature are just overloads to make it easier to use.
Definition at line 39 of file CrestContainer.cxx.
It adds a column to the payload specification.
name | The name of the column. |
type | The type of the column. |
This method adds a column to the payload specification. filling the vector m_payload_spec. The methods with a different signature are just overloads to make it easier to use.
Definition at line 34 of file CrestContainer.cxx.
void Crest::CrestContainer::addData | ( | const std::string & | channel_id | ) |
It associate the payload row to a channel_id.
channel_id | The channel_id to associate the payload row. |
The method adds the current payload row to the json object m_payload. The row is associated with the channel_id.
Definition at line 118 of file CrestContainer.cxx.
void Crest::CrestContainer::addExternalData | ( | const std::string & | channel_id, |
const nlohmann::json & | data | ||
) |
It associate the payload row to a channel_id.
channel_id | The channel_id to associate the payload row. |
data | The data to be associated with the channel_id. |
The method adds the payload row to the json object m_payload. The row is associated with the channel_id. The data is the data to be associated with the channel_id, and they belong to a previously filled payload row.
Definition at line 123 of file CrestContainer.cxx.
void Crest::CrestContainer::addIov | ( | const uint64_t | since | ) |
It adds an IOV to the json object m_iov_data.
since | The since value of the IOV. |
The data is a json object containing all channels stored before, and kept in m_payload.
Definition at line 155 of file CrestContainer.cxx.
void Crest::CrestContainer::addNullRecord | ( | const std::string & | name | ) |
It adds a null value to the payload.
name | The name of the column. |
This method adds a null to the payload. It fills the json object m_row.
Definition at line 51 of file CrestContainer.cxx.
void Crest::CrestContainer::addRecord | ( | const std::string & | name, |
int | number, | ||
... | |||
) |
It adds a record to the payload.
name | The name of the column. |
number | The number of parameters. |
... | The values of the record. |
This method adds a record to the payload. It fills the json object m_row.
Definition at line 63 of file CrestContainer.cxx.
std::vector< std::string > Crest::CrestContainer::channelIds | ( | ) |
void Crest::CrestContainer::clear | ( | ) |
|
private |
Definition at line 140 of file CrestContainer.cxx.
void Crest::CrestContainer::dumpJsonToFile | ( | const nlohmann::json & | j, |
const std::string & | filename | ||
) |
It creates a file with the json representation of the container.
Definition at line 347 of file CrestContainer.cxx.
void Crest::CrestContainer::flush | ( | ) |
std::vector< uint64_t > Crest::CrestContainer::fromJson | ( | uint64_t | since, |
const nlohmann::json & | j | ||
) |
int Crest::CrestContainer::getColumnIndex | ( | const std::string & | name | ) |
It returns the index of the column with the given name.
name | The name of the column. It checks the payload spec array to get the index back. |
Definition at line 211 of file CrestContainer.cxx.
uint64_t Crest::CrestContainer::getFirstTime | ( | ) |
const nlohmann::json & Crest::CrestContainer::getIovData | ( | ) |
Return selected IOV in json format.
JSON has two filed: since (for timestamp) and data (for payload).
Definition at line 262 of file CrestContainer.cxx.
std::string Crest::CrestContainer::getJsonIovData | ( | ) |
It returns the json representation of the container.
Definition at line 287 of file CrestContainer.cxx.
std::string Crest::CrestContainer::getJsonPayload | ( | ) |
It returns the json representation of the container.
Definition at line 282 of file CrestContainer.cxx.
const std::vector< std::pair< std::string, Crest::TypeId > > & Crest::CrestContainer::getMPayloadSpec | ( | ) |
Return tag specification in vector format.
Elements of vector is pair: name and type.
Definition at line 191 of file CrestContainer.cxx.
const nlohmann::json & Crest::CrestContainer::getPayload | ( | ) |
const nlohmann::json Crest::CrestContainer::getPayloadChannel | ( | const std::string & | channel_id | ) |
Return payload in json format for selected channel id.
channel_id | The channel id. |
Definition at line 196 of file CrestContainer.cxx.
json Crest::CrestContainer::getPayloadSpec | ( | ) |
|
private |
Definition at line 241 of file CrestContainer.cxx.
nlohmann::json Crest::CrestContainer::getStoreSetDto | ( | uint64_t | period = -1 | ) |
It return StoreSetDto in json format.
period | It set max interval for DSC data. Value '-1' mean that store all DCS data in one StoreDto. This parameter do not use for standard mode. |
Definition at line 657 of file CrestContainer.cxx.
bool Crest::CrestContainer::isVectorPayload | ( | ) |
It sets the Vector mode of the container.
Definition at line 19 of file CrestContainer.cxx.
void Crest::CrestContainer::parseData | ( | const nlohmann::json & | values | ) |
It reads a json object, parse it and fill the container.
values | The input json with data. |
Definition at line 494 of file CrestContainer.cxx.
|
private |
Definition at line 396 of file CrestContainer.cxx.
void Crest::CrestContainer::putRow2Vector | ( | ) |
It adds row data to vector.
This method should use for Vector type of data. It should call after all data of row is added.
Definition at line 227 of file CrestContainer.cxx.
|
private |
Definition at line 629 of file CrestContainer.cxx.
|
private |
Definition at line 602 of file CrestContainer.cxx.
nlohmann::json Crest::CrestContainer::readJsonFromFile | ( | const std::string & | filename, |
const std::string & | spec_filename | ||
) |
It reads a json file and returns the json object.
Definition at line 363 of file CrestContainer.cxx.
void Crest::CrestContainer::selectIov | ( | const uint64_t | since | ) |
It select timestamp as active.
since | It is selected timastamp. |
Definition at line 163 of file CrestContainer.cxx.
|
private |
Definition at line 272 of file CrestContainer.cxx.
|
private |
Definition at line 277 of file CrestContainer.cxx.
|
private |
Definition at line 309 of file CrestContainer.cxx.
void Crest::CrestContainer::setVectorPayload | ( | bool | isVectorPayload | ) |
Set the Vectore mode of the container.
isVectorPayload | True if it is Vector payload. |
Definition at line 23 of file CrestContainer.cxx.
|
private |
Definition at line 227 of file CrestContainer.h.
|
private |
Definition at line 225 of file CrestContainer.h.
|
private |
Definition at line 229 of file CrestContainer.h.
|
private |
Definition at line 228 of file CrestContainer.h.
|
private |
Definition at line 223 of file CrestContainer.h.
|
private |
Definition at line 222 of file CrestContainer.h.
|
private |
Definition at line 224 of file CrestContainer.h.
|
private |
Definition at line 226 of file CrestContainer.h.