Belle II Software development
EventMetaDataSerialization Class Reference

Helper class for (de)serializing the event meta data used for the event backup transferral. More...

#include <EventMetaDataSerialization.h>

Static Public Member Functions

static EventMetaData deserialize (std::string stream)
 Deserialize the event data from a string.
 
static std::string serialize (const EventMetaData &eventMetaData)
 Serialize the event meta data to a string.
 

Detailed Description

Helper class for (de)serializing the event meta data used for the event backup transferral.

Definition at line 20 of file EventMetaDataSerialization.h.

Member Function Documentation

◆ deserialize()

static EventMetaData deserialize ( std::string  stream)
inlinestatic

Deserialize the event data from a string.

Definition at line 23 of file EventMetaDataSerialization.h.

24 {
25 size_t pos = stream.find(':');
26 int event = atoi(stream.substr(0, pos).c_str());
27 stream.erase(0, pos + 1);
28 pos = stream.find(':');
29 int run = atoi(stream.substr(0, pos).c_str());
30 stream.erase(0, pos + 1);
31 pos = stream.find(':');
32 int experiment = atoi(stream.substr(0, pos).c_str());
33 return EventMetaData(event, run, experiment);
34 }

◆ serialize()

static std::string serialize ( const EventMetaData eventMetaData)
inlinestatic

Serialize the event meta data to a string.

Definition at line 37 of file EventMetaDataSerialization.h.

38 {
39 return std::to_string(eventMetaData.getEvent()) + ":" +
40 std::to_string(eventMetaData.getRun()) + ":" +
41 std::to_string(eventMetaData.getExperiment());
42 }

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