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

#include <DatamodelRegistryIOHelpers.h>

Public Member Functions

void registerDatamodelDefinition (const podio::CollectionBase *coll, const std::string &name)
 
std::vector< std::tuple< std::string, std::string > > getDatamodelDefinitionsToWrite () const
 Get all the names and JSON definitions that need to be written.
 

Detailed Description

Helper class to collect the datamodel (JSON) definitions that should be written.

Definition at line 18 of file DatamodelRegistryIOHelpers.h.

Member Function Documentation

◆ getDatamodelDefinitionsToWrite()

std::vector< std::tuple< std::string, std::string > > podio::DatamodelDefinitionCollector::getDatamodelDefinitionsToWrite ( ) const

Get all the names and JSON definitions that need to be written.

Definition at line 18 of file DatamodelRegistryIOHelpers.cc.

18 {
19 std::vector<std::tuple<std::string, std::string>> edmDefinitions;
20 edmDefinitions.reserve(m_edmDefRegistryIdcs.size());
21 for (const auto& index : m_edmDefRegistryIdcs) {
22 const auto& edmRegistry = podio::DatamodelRegistry::instance();
23 edmDefinitions.emplace_back(edmRegistry.getDatamodelName(index), edmRegistry.getDatamodelDefinition(index));
24 }
25
26 return edmDefinitions;
27}
static const DatamodelRegistry & instance()
Get the registry.

Referenced by podio::ROOTFrameWriter::finish(), and podio::SIOFrameWriter::finish().

◆ registerDatamodelDefinition()

void podio::DatamodelDefinitionCollector::registerDatamodelDefinition ( const podio::CollectionBase coll,
const std::string &  name 
)

Register the datamodel definition of the EDM this collection is from to be written.

Parameters
collA collection of an EDM
nameThe name under which this collection is stored on file

Definition at line 6 of file DatamodelRegistryIOHelpers.cc.

7 {
8 const auto edmIndex = coll->getDatamodelRegistryIndex();
10 std::cerr << "No EDM definition available for collection " << name << std::endl;
11 } else {
13 m_edmDefRegistryIdcs.insert(edmIndex);
14 }
15 }
16}
virtual size_t getDatamodelRegistryIndex() const =0
Get the index in the DatatypeRegistry of the EDM this collection belongs to.
static constexpr size_t NoDefinitionAvailable
Dedicated index value for error checking, used to default init the generated RegistryIndex.
static constexpr size_t NoDefinitionNecessary

Referenced by podio::ROOTFrameWriter::writeFrame(), and podio::SIOFrameWriter::writeFrame().


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