File SIOBlock.h

namespace podio

Functions

template<typename devT, typename PODData>
void handlePODDataSIO(devT &device, PODData *data, size_t size)
template<typename MapLikeT>
void writeMapLike(sio::write_device &device, const MapLikeT &map)

Write anything that iterates like an std::map.

template<typename MapLikeT>
void readMapLike(sio::read_device &device, MapLikeT &map)

Read anything that iterates like an std::map.

class SIOBlock : public sio::block
#include <podio/SIOBlock.h>

Base class for sio::block handlers used with PODIO.

Subclassed by podio::SIOBlockUserData< BasicType, typename >

Public Functions

inline SIOBlock(const std::string &nam, sio::version_type vers)
SIOBlock() = delete
SIOBlock(const SIOBlock&) = delete
SIOBlock &operator=(const SIOBlock&) = delete
inline podio::CollectionBase *getCollection()
inline podio::CollectionReadBuffers getBuffers() const
inline std::string name()
inline void setSubsetCollection(bool subsetColl)
inline void setCollection(podio::CollectionBase *col)
virtual SIOBlock *create(const std::string &name) const = 0

Protected Attributes

bool m_subsetColl = {false}
podio::CollectionReadBuffers m_buffers = {}
class SIOBlockFactory
#include <podio/SIOBlock.h>

factory for creating sio::blocks for a given type of EDM-collection

Public Functions

inline void registerBlockForCollection(const std::string &type, SIOBlock *b)
std::shared_ptr<SIOBlock> createBlock(const podio::CollectionBase *col, const std::string &name) const
std::shared_ptr<SIOBlock> createBlock(const std::string &typeStr, const std::string &name, const bool isRefColl = false) const

Public Static Functions

static inline SIOBlockFactory &instance()

Private Types

typedef std::unordered_map<std::string, SIOBlock*> BlockMap

Private Functions

SIOBlockFactory() = default

Private Members

BlockMap _map = {}
class SIOBlockLibraryLoader
#include <podio/SIOBlock.h>

Public Static Functions

static inline SIOBlockLibraryLoader &instance()

Private Types

enum class LoadStatus : short

Status code for loading shared SIOBlocks libraries.

Values:

enumerator Success
enumerator AlreadyLoaded
enumerator Error

Private Functions

SIOBlockLibraryLoader()
LoadStatus loadLib(const std::string &libname)

Load a library with the given name via dlopen.

Private Members

std::map<std::string, void*> _loadedLibs = {}

Private Static Functions

static std::vector<std::tuple<std::string, std::string>> getLibNames()

Get all files that are found on LD_LIBRARY_PATH and that have “SioBlocks” in their name together with the directory they are in.

class SIOCollectionIDTableBlock : public sio::block
#include <podio/SIOBlock.h>

A dedicated block for handling the I/O of the CollectionIDTable.

Public Functions

inline SIOCollectionIDTableBlock()
inline SIOCollectionIDTableBlock(std::vector<std::string> &&names, std::vector<uint32_t> &&ids, std::vector<std::string> &&types, std::vector<short> &&isSubsetColl)
SIOCollectionIDTableBlock(const SIOCollectionIDTableBlock&) = delete
SIOCollectionIDTableBlock &operator=(const SIOCollectionIDTableBlock&) = delete
void read(sio::read_device &device, sio::version_type version) override
void write(sio::write_device &device) override
inline podio::CollectionIDTable getTable()
inline const std::vector<std::string> &getTypeNames() const
inline const std::vector<short> &getSubsetCollectionBits() const

Private Members

std::vector<std::string> _names = {}
std::vector<uint32_t> _ids = {}
std::vector<std::string> _types = {}
std::vector<short> _isSubsetColl = {}
class SIOEventMetaDataBlock : public sio::block
#include <podio/SIOBlock.h>

A block for handling the EventMeta data.

Public Functions

inline SIOEventMetaDataBlock()
SIOEventMetaDataBlock(const SIOEventMetaDataBlock&) = delete
SIOEventMetaDataBlock &operator=(const SIOEventMetaDataBlock&) = delete
void read(sio::read_device &device, sio::version_type version) override
void write(sio::write_device &device) override

Public Members

podio::GenericParameters *metadata = {nullptr}
class SIOFileTOCRecord
#include <podio/SIOBlock.h>

Public Types

using PositionType = sio_helpers::position_type

Public Functions

void addRecord(const std::string &name, PositionType startPos)
size_t getNRecords(const std::string &name) const
PositionType getPosition(const std::string &name, unsigned iEntry = 0) const

Get the position of the iEntry-th record with the given name.

If no entry with the given name is recorded, return 0. Note there is no internal check on whether the given name actually has iEntry records. Use getNRecords to check for that if necessary.

std::vector<std::string_view> getRecordNames() const

Get all the record names that are stored in this TOC record.

Private Types

using RecordListType = std::pair<std::string, std::vector<PositionType>>
using MapType = std::vector<RecordListType>

Private Members

MapType m_recordMap = {}

Friends

friend struct SIOFileTOCRecordBlock
struct SIOFileTOCRecordBlock : public sio::block
#include <podio/SIOBlock.h>

Public Functions

inline SIOFileTOCRecordBlock()
inline SIOFileTOCRecordBlock(SIOFileTOCRecord *r)
SIOFileTOCRecordBlock(const SIOFileTOCRecordBlock&) = delete
SIOFileTOCRecordBlock &operator=(const SIOFileTOCRecordBlock&) = delete
void read(sio::read_device &device, sio::version_type version) override
void write(sio::write_device &device) override

Public Members

SIOFileTOCRecord *record = {nullptr}
template<typename KeyT, typename ValueT>
struct SIOMapBlock : public sio::block
#include <podio/SIOBlock.h>

A block to serialize anything that behaves similar in iterating as a map<KeyT, ValueT>, e.g.

vector<tuple<KeyT, ValueT>>, which is what is used internally to represent the data to be written.

Public Functions

inline SIOMapBlock()
inline SIOMapBlock(std::vector<std::tuple<KeyT, ValueT>> &&data)
SIOMapBlock(const SIOMapBlock&) = delete
SIOMapBlock &operator=(const SIOMapBlock&) = delete
inline void read(sio::read_device &device, sio::version_type) override
inline void write(sio::write_device &device) override

Public Members

std::vector<std::tuple<KeyT, ValueT>> mapData = {}
class SIONumberedMetaDataBlock : public sio::block
#include <podio/SIOBlock.h>

A block for handling the run and collection meta data.

Public Functions

inline SIONumberedMetaDataBlock(const std::string &name)
SIONumberedMetaDataBlock(const SIONumberedMetaDataBlock&) = delete
SIONumberedMetaDataBlock &operator=(const SIONumberedMetaDataBlock&) = delete
void read(sio::read_device &device, sio::version_type version) override
void write(sio::write_device &device) override

Public Members

std::map<int, GenericParameters> *data = {nullptr}
struct SIOVersionBlock : public sio::block
#include <podio/SIOBlock.h>

Public Functions

inline SIOVersionBlock()
inline SIOVersionBlock(podio::version::Version v)
inline void write(sio::write_device &device) override
inline void read(sio::read_device &device, sio::version_type) override

Public Members

podio::version::Version version = {}
namespace sio_helpers

Typedefs

using position_type = uint32_t

Variables

static constexpr uint32_t SIOTocMarker = 0xc001fea7

marker for showing that a TOC has been stored in the file

static constexpr int SIOTocInfoSize = sizeof(uint64_t)

the number of bits necessary to store the SIOTocMarker and the actual position of the start of the SIOFileTOCRecord

static constexpr const char *SIOTocRecordName = "podio_SIO_TOC_Record"

The name of the TOCRecord.

static constexpr const char *SIOEDMDefinitionName = "podio_SIO_EDMDefinitions"

The name of the record containing the EDM definitions in json format.