PODIO v00-16-03
An Event-Data-Model Toolkit for High Energy Physics Experiments
Loading...
Searching...
No Matches
podio::SIOBlockUserData< BasicType, typename > Class Template Reference

#include <SIOBlockUserData.h>

+ Inheritance diagram for podio::SIOBlockUserData< BasicType, typename >:

Public Member Functions

 SIOBlockUserData ()
 
 SIOBlockUserData (const std::string &name)
 
void read (sio::read_device &device, sio::version_type) override
 
void write (sio::write_device &device) override
 
void createBuffers (bool) override
 
SIOBlockcreate (const std::string &name) const override
 
- Public Member Functions inherited from podio::SIOBlock
 SIOBlock (const std::string &nam, sio::version_type vers)
 
 SIOBlock ()=delete
 
 SIOBlock (const SIOBlock &)=delete
 
SIOBlockoperator= (const SIOBlock &)=delete
 
podio::CollectionBasegetCollection ()
 
podio::CollectionReadBuffers getBuffers () const
 
std::string name ()
 
void setCollection (podio::CollectionBase *col)
 
virtual SIOBlockcreate (const std::string &name) const =0
 
virtual void createBuffers (const bool subsetCollection=false)=0
 

Additional Inherited Members

- Protected Attributes inherited from podio::SIOBlock
bool m_subsetColl {false}
 
podio::CollectionReadBuffers m_buffers {}
 

Detailed Description

template<typename BasicType, typename = EnableIfSupportedUserType<BasicType>>
class podio::SIOBlockUserData< BasicType, typename >

Definition at line 30 of file SIOBlockUserData.h.

Constructor & Destructor Documentation

◆ SIOBlockUserData() [1/2]

template<typename BasicType , typename = EnableIfSupportedUserType<BasicType>>
podio::SIOBlockUserData< BasicType, typename >::SIOBlockUserData ( )
inline

Definition at line 32 of file SIOBlockUserData.h.

32 : SIOBlock(::sio_name<BasicType>(), sio::version::encode_version(0, 1)) {
33
34 podio::SIOBlockFactory::instance().registerBlockForCollection(podio::userDataTypeName<BasicType>(), this);
35 }
void registerBlockForCollection(const std::string &type, SIOBlock *b)
Definition: SIOBlock.h:226
static SIOBlockFactory & instance()
Definition: SIOBlock.h:236
SIOBlock()=delete

Referenced by podio::SIOBlockUserData< BasicType, typename >::create().

◆ SIOBlockUserData() [2/2]

template<typename BasicType , typename = EnableIfSupportedUserType<BasicType>>
podio::SIOBlockUserData< BasicType, typename >::SIOBlockUserData ( const std::string &  name)
inline

Definition at line 37 of file SIOBlockUserData.h.

37 : SIOBlock(name, sio::version::encode_version(0, 1)) {
38 }
std::string name()
Definition: SIOBlock.h:77

Member Function Documentation

◆ create()

template<typename BasicType , typename = EnableIfSupportedUserType<BasicType>>
SIOBlock * podio::SIOBlockUserData< BasicType, typename >::create ( const std::string &  name) const
inlineoverridevirtual

Implements podio::SIOBlock.

Definition at line 67 of file SIOBlockUserData.h.

67 {
68 return new SIOBlockUserData(name);
69 }

◆ createBuffers()

template<typename BasicType , typename = EnableIfSupportedUserType<BasicType>>
void podio::SIOBlockUserData< BasicType, typename >::createBuffers ( bool  )
inlineoverridevirtual

Implements podio::SIOBlock.

Definition at line 56 of file SIOBlockUserData.h.

56 {
57
60
61 // Nothing to do here since UserDataCollections cannot be subset collections
63 return std::make_unique<UserDataCollection<BasicType>>(std::move(*buffers.dataAsVector<BasicType>()));
64 };
65 }
podio::CollectionReadBuffers m_buffers
Definition: SIOBlock.h:93
std::vector< std::pair< std::string, void * > > VectorMembersInfo
std::vector< UVecPtr< podio::ObjectID > > CollRefCollection
CollRefCollection * references
std::vector< DataT > * dataAsVector()
VectorMembersInfo * vectorMembers

◆ read()

template<typename BasicType , typename = EnableIfSupportedUserType<BasicType>>
void podio::SIOBlockUserData< BasicType, typename >::read ( sio::read_device &  device,
sio::version_type   
)
inlineoverride

Definition at line 40 of file SIOBlockUserData.h.

40 {
41 auto* dataVec = new std::vector<BasicType>();
42 unsigned size(0);
43 device.data(size);
44 dataVec->resize(size);
45 podio::handlePODDataSIO(device, &(*dataVec)[0], size);
46 m_buffers.data = dataVec;
47 }
void handlePODDataSIO(devT &device, PODData *data, size_t size)
Definition: SIOBlock.h:25

◆ write()

template<typename BasicType , typename = EnableIfSupportedUserType<BasicType>>
void podio::SIOBlockUserData< BasicType, typename >::write ( sio::write_device &  device)
inlineoverride

Definition at line 49 of file SIOBlockUserData.h.

49 {
50 auto* dataVec = podio::CollectionWriteBuffers::asVector<BasicType>(m_buffers.data);
51 unsigned size = dataVec->size();
52 device.data(size);
53 podio::handlePODDataSIO(device, &(*dataVec)[0], size);
54 }

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