ATLAS Offline Software
|
#include <CrestContainer.h>
Public Member Functions | |
CrestContainer () | |
~CrestContainer () | |
void | addColumn (const std::string &name, TypeId type) |
It adds a column to the payload specification. More... | |
void | addColumn (const std::string &name, const char *type) |
void | addColumn (const std::string &name, uint32_t type) |
bool | isVectorPayload () |
It sets the mode of the container. More... | |
void | setVectorPayload (bool isVectorPayload) |
Crest::TypeId | stringToTypeId (const std::string &type) const |
Crest::TypeId | intToTypeId (int value) const |
void | putRow2Vector () |
It adds row data to vector. More... | |
void | addNullRecord (const char *name) |
It adds a null value to the payload. More... | |
void | addRecord (const char *name, int number,...) |
It adds a record to the payload. More... | |
void | addData (const char *channel_id) |
It associate the payload row to a channel_id. More... | |
void | addExternalData (const char *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 () |
template<typename T > | |
T | getRecord (const std::string &name) |
const nlohmann::json & | getPayload () |
const nlohmann::json & | getIovData () |
const nlohmann::json & | getPayloadChannel (const char *channel_id) |
void | setIovData (const nlohmann::json &j) |
void | setPayload (const nlohmann::json &j) |
nlohmann::json | getPayloadSpec () |
void | setPayloadSpec (const nlohmann::json &j) |
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 () |
void | selectIov (const uint64_t since) |
std::vector< std::string > | channelIds () |
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 | dump_json_to_file (const nlohmann::json &j, const std::string &filename) |
It creates a file with the json representation of the container. More... | |
nlohmann::json | read_json_from_file (const std::string &filename, const std::string &spec_filename) |
It reads a json file and returns the json object. More... | |
void | from_json (const uint64_t since, const nlohmann::json &j) |
It reads a json object to fill the containers. More... | |
void | parseOldFormat (std::string &colName, TypeId &typespec, const nlohmann::json &j) |
Static Public Member Functions | |
static std::string | base64_encode (const uint8_t *bytes_to_encode, unsigned int in_len) |
It encodes the input string to base64. More... | |
static std::vector< unsigned char > | base64_decode (const std::string &encodedData) |
It decodes the input string from base64. More... | |
Private Member Functions | |
void | validatePayloadSize (const nlohmann::json &data) const |
nlohmann::json | createRowArray (const nlohmann::json &data_row) const |
const nlohmann::json & | getRow () |
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() |
nlohmann::json | m_full_data ={} |
ModeId | m_modeId |
bool | m_isVectorPayload =false |
Definition at line 54 of file CrestContainer.h.
Crest::CrestContainer::CrestContainer | ( | ) |
Definition at line 17 of file CrestContainer.cxx.
Crest::CrestContainer::~CrestContainer | ( | ) |
Definition at line 18 of file CrestContainer.cxx.
Definition at line 84 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 79 of file CrestContainer.cxx.
void Crest::CrestContainer::addColumn | ( | const std::string & | name, |
uint32_t | type | ||
) |
void Crest::CrestContainer::addData | ( | const char * | 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 160 of file CrestContainer.cxx.
void Crest::CrestContainer::addExternalData | ( | const char * | 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 165 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 214 of file CrestContainer.cxx.
void Crest::CrestContainer::addNullRecord | ( | const char * | 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 94 of file CrestContainer.cxx.
void Crest::CrestContainer::addRecord | ( | const char * | 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 106 of file CrestContainer.cxx.
|
static |
It decodes the input string from base64.
Definition at line 65 of file CrestContainer.cxx.
|
static |
std::vector< std::string > Crest::CrestContainer::channelIds | ( | ) |
Definition at line 227 of file CrestContainer.cxx.
void Crest::CrestContainer::clear | ( | ) |
Definition at line 394 of file CrestContainer.cxx.
|
private |
Definition at line 199 of file CrestContainer.cxx.
void Crest::CrestContainer::dump_json_to_file | ( | const nlohmann::json & | j, |
const std::string & | filename | ||
) |
It creates a file with the json representation of the container.
Definition at line 403 of file CrestContainer.cxx.
void Crest::CrestContainer::flush | ( | ) |
void Crest::CrestContainer::from_json | ( | const uint64_t | since, |
const nlohmann::json & | j | ||
) |
It reads a json object to fill the containers.
Definition at line 547 of file CrestContainer.cxx.
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 266 of file CrestContainer.cxx.
const nlohmann::json & Crest::CrestContainer::getIovData | ( | ) |
Definition at line 318 of file CrestContainer.cxx.
std::string Crest::CrestContainer::getJsonIovData | ( | ) |
It returns the json representation of the container.
Definition at line 343 of file CrestContainer.cxx.
std::string Crest::CrestContainer::getJsonPayload | ( | ) |
It returns the json representation of the container.
Definition at line 338 of file CrestContainer.cxx.
const std::vector< std::pair< std::string, Crest::TypeId > > & Crest::CrestContainer::getMPayloadSpec | ( | ) |
Definition at line 234 of file CrestContainer.cxx.
const nlohmann::json & Crest::CrestContainer::getPayload | ( | ) |
Definition at line 304 of file CrestContainer.cxx.
const nlohmann::json & Crest::CrestContainer::getPayloadChannel | ( | const char * | channel_id | ) |
Definition at line 239 of file CrestContainer.cxx.
json Crest::CrestContainer::getPayloadSpec | ( | ) |
Definition at line 348 of file CrestContainer.cxx.
|
inline |
Definition at line 143 of file CrestContainer.h.
|
private |
Definition at line 296 of file CrestContainer.cxx.
Crest::TypeId Crest::CrestContainer::intToTypeId | ( | int | value | ) | const |
Definition at line 42 of file CrestContainer.cxx.
bool Crest::CrestContainer::isVectorPayload | ( | ) |
It sets the mode of the container.
Definition at line 23 of file CrestContainer.cxx.
void Crest::CrestContainer::parseOldFormat | ( | std::string & | colName, |
TypeId & | typespec, | ||
const nlohmann::json & | j | ||
) |
Definition at line 449 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 282 of file CrestContainer.cxx.
nlohmann::json Crest::CrestContainer::read_json_from_file | ( | const std::string & | filename, |
const std::string & | spec_filename | ||
) |
It reads a json file and returns the json object.
Definition at line 418 of file CrestContainer.cxx.
void Crest::CrestContainer::selectIov | ( | const uint64_t | since | ) |
Definition at line 222 of file CrestContainer.cxx.
void Crest::CrestContainer::setIovData | ( | const nlohmann::json & | j | ) |
Definition at line 328 of file CrestContainer.cxx.
void Crest::CrestContainer::setPayload | ( | const nlohmann::json & | j | ) |
Definition at line 333 of file CrestContainer.cxx.
void Crest::CrestContainer::setPayloadSpec | ( | const nlohmann::json & | j | ) |
Definition at line 365 of file CrestContainer.cxx.
void Crest::CrestContainer::setVectorPayload | ( | bool | isVectorPayload | ) |
Definition at line 27 of file CrestContainer.cxx.
Crest::TypeId Crest::CrestContainer::stringToTypeId | ( | const std::string & | type | ) | const |
|
private |
Definition at line 189 of file CrestContainer.cxx.
|
private |
Definition at line 61 of file CrestContainer.h.
|
private |
Definition at line 59 of file CrestContainer.h.
|
private |
Definition at line 63 of file CrestContainer.h.
|
private |
Definition at line 62 of file CrestContainer.h.
|
private |
Definition at line 57 of file CrestContainer.h.
|
private |
Definition at line 56 of file CrestContainer.h.
|
private |
Definition at line 58 of file CrestContainer.h.
|
private |
Definition at line 60 of file CrestContainer.h.