1#ifndef PODIO_SIOBLOCKUSERDATA_H
2#define PODIO_SIOBLOCKUSERDATA_H
9#include <sio/io_device.h>
10#include <sio/version.h>
19template <
typename BasicType,
typename = podio::EnableIfSupportedUserType<BasicType>>
20inline std::string sio_name() {
21 std::string s = podio::userDataTypeName<BasicType>();
22 std::replace(s.begin(), s.end(),
' ',
'_');
29template <
typename BasicType,
typename = EnableIfSupportedUserType<BasicType>>
40 void read(sio::read_device& device, sio::version_type )
override {
41 auto* dataVec =
new std::vector<BasicType>();
44 dataVec->resize(size);
49 void write(sio::write_device& device)
override {
50 auto* dataVec = podio::CollectionWriteBuffers::asVector<BasicType>(
m_buffers.
data);
51 unsigned size = dataVec->size();
63 return std::make_unique<UserDataCollection<BasicType>>(std::move(*buffers.
dataAsVector<BasicType>()));
void registerBlockForCollection(const std::string &type, SIOBlock *b)
static SIOBlockFactory & instance()
SIOBlockUserData(const std::string &name)
SIOBlock * create(const std::string &name) const override
void read(sio::read_device &device, sio::version_type) override
void createBuffers(bool) override
void write(sio::write_device &device) override
Base class for sio::block handlers used with PODIO.
podio::CollectionReadBuffers m_buffers
std::vector< std::pair< std::string, void * > > VectorMembersInfo
std::vector< UVecPtr< podio::ObjectID > > CollRefCollection
void handlePODDataSIO(devT &device, PODData *data, size_t size)
CreateFuncT createCollection
CollRefCollection * references
std::vector< DataT > * dataAsVector()
VectorMembersInfo * vectorMembers