PODIO v00-16-03
An Event-Data-Model Toolkit for High Energy Physics Experiments
Loading...
Searching...
No Matches
podio::SIOBlockFactory Class Reference

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

#include <SIOBlock.h>

Public Member Functions

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

Static Public Member Functions

static SIOBlockFactoryinstance ()
 

Detailed Description

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

Definition at line 218 of file SIOBlock.h.

Member Function Documentation

◆ createBlock() [1/2]

std::shared_ptr< SIOBlock > podio::SIOBlockFactory::createBlock ( const podio::CollectionBase col,
const std::string &  name 
) const

Definition at line 110 of file SIOBlock.cc.

111 {
112 const std::string typeStr = col->getValueTypeName();
113 const auto it = _map.find(typeStr);
114
115 if (it != _map.end()) {
116 auto blk = std::shared_ptr<SIOBlock>(it->second->create(name));
117 blk->setCollection(const_cast<podio::CollectionBase*>(col));
118 return blk;
119 } else {
120 return nullptr;
121 }
122}
virtual std::string getValueTypeName() const =0
fully qualified type name of elements - with namespace

Referenced by podio::sio_utils::createBlocks().

◆ createBlock() [2/2]

std::shared_ptr< SIOBlock > podio::SIOBlockFactory::createBlock ( const std::string &  typeStr,
const std::string &  name,
const bool  isRefColl = false 
) const

Definition at line 97 of file SIOBlock.cc.

98 {
99 const auto it = _map.find(typeStr);
100
101 if (it != _map.end()) {
102 auto blk = std::shared_ptr<SIOBlock>(it->second->create(name));
103 blk->createBuffers(isSubsetColl);
104 return blk;
105 } else {
106 return nullptr;
107 }
108}

◆ instance()

static SIOBlockFactory & podio::SIOBlockFactory::instance ( )
inlinestatic

Definition at line 236 of file SIOBlock.h.

236 {
237 static SIOBlockFactory me;
238 return me;
239 }

Referenced by podio::sio_utils::createBlocks(), podio::SIOWriter::registerForWrite(), and podio::SIOBlockUserData< BasicType, typename >::SIOBlockUserData().

◆ registerBlockForCollection()

void podio::SIOBlockFactory::registerBlockForCollection ( const std::string &  type,
SIOBlock b 
)
inline

Definition at line 226 of file SIOBlock.h.

226 {
227 _map[type] = b;
228 }

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


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