Belle II Software light-2406-ragdoll
EventMetaDataSerialization.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <framework/dataobjects/EventMetaData.h>
11#include <string>
12
13namespace Belle2 {
21 public:
23 static EventMetaData deserialize(std::string stream)
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 }
35
37 static std::string serialize(const EventMetaData& eventMetaData)
38 {
39 return std::to_string(eventMetaData.getEvent()) + ":" +
40 std::to_string(eventMetaData.getRun()) + ":" +
41 std::to_string(eventMetaData.getExperiment());
42 }
43 };
45}
Helper class for (de)serializing the event meta data used for the event backup transferral.
static std::string serialize(const EventMetaData &eventMetaData)
Serialize the event meta data to a string.
static EventMetaData deserialize(std::string stream)
Deserialize the event data from a string.
Store event, run, and experiment numbers.
Definition: EventMetaData.h:33
int getRun() const
Run Getter.
unsigned int getEvent() const
Event Getter.
int getExperiment() const
Experiment Getter.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24