Belle II Software  release-08-01-10
StreamHelper.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 #include <framework/pcore/DataStoreStreamer.h>
10 #include <framework/pcore/zmq/messages/ZMQNoIdMessage.h>
11 #include <framework/datastore/StoreObjPtr.h>
12 #include <framework/core/RandomGenerator.h>
13 
14 #include <memory>
15 
16 namespace Belle2 {
23  class StreamHelper {
24  public:
26  void initialize(int compressionLevel, bool handleMergeable);
28  std::unique_ptr<EvtMessage> stream(bool addPersistentDurability = true, bool streamTransientObjects = true);
30  void read(std::unique_ptr<ZMQNoIdMessage> message);
31 
32  private:
34  std::unique_ptr<DataStoreStreamer> m_streamer;
37  };
39 }
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Helper class for data store serialization.
Definition: StreamHelper.h:23
std::unique_ptr< DataStoreStreamer > m_streamer
The data store streamer to use.
Definition: StreamHelper.h:34
void read(std::unique_ptr< ZMQNoIdMessage > message)
Read in a ZMQ message and rebuilt the data store from it.
Definition: StreamHelper.cc:41
std::unique_ptr< EvtMessage > stream(bool addPersistentDurability=true, bool streamTransientObjects=true)
Stream the data store into an event message.
Definition: StreamHelper.cc:29
void initialize(int compressionLevel, bool handleMergeable)
Initialize this class. Call this e.g. in the first event.
Definition: StreamHelper.cc:18
StoreObjPtr< RandomGenerator > m_randomGenerator
The random generator object in the data store that we need to transport also.
Definition: StreamHelper.h:36
Abstract base class for different kinds of events.