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

#include <DatamodelRegistryIOHelpers.h>

Public Types

using MapType = std::vector< std::tuple< std::string, std::string > >
 The "map" type that is used internally.
 

Public Member Functions

 DatamodelDefinitionHolder (MapType &&definitions)
 Constructor from an existing collection of names and datamodel definitions.
 
 DatamodelDefinitionHolder ()=default
 
 ~DatamodelDefinitionHolder ()=default
 
 DatamodelDefinitionHolder (const DatamodelDefinitionHolder &)=delete
 
DatamodelDefinitionHolderoperator= (const DatamodelDefinitionHolder &)=delete
 
 DatamodelDefinitionHolder (DatamodelDefinitionHolder &&)=default
 
DatamodelDefinitionHolderoperator= (DatamodelDefinitionHolder &&)=default
 
const std::string_view getDatamodelDefinition (const std::string &name) const
 
std::vector< std::string > getAvailableDatamodels () const
 

Protected Attributes

MapType m_availEDMDefs {}
 

Detailed Description

Helper class to hold and provide the datamodel (JSON) definitions for reader classes.

Definition at line 40 of file DatamodelRegistryIOHelpers.h.

Member Typedef Documentation

◆ MapType

using podio::DatamodelDefinitionHolder::MapType = std::vector<std::tuple<std::string, std::string> >

The "map" type that is used internally.

Definition at line 43 of file DatamodelRegistryIOHelpers.h.

Constructor & Destructor Documentation

◆ DatamodelDefinitionHolder() [1/4]

podio::DatamodelDefinitionHolder::DatamodelDefinitionHolder ( MapType &&  definitions)
inline

Constructor from an existing collection of names and datamodel definitions.

Definition at line 45 of file DatamodelRegistryIOHelpers.h.

45 : m_availEDMDefs(std::move(definitions)) {
46 }

◆ DatamodelDefinitionHolder() [2/4]

podio::DatamodelDefinitionHolder::DatamodelDefinitionHolder ( )
default

◆ ~DatamodelDefinitionHolder()

podio::DatamodelDefinitionHolder::~DatamodelDefinitionHolder ( )
default

◆ DatamodelDefinitionHolder() [3/4]

podio::DatamodelDefinitionHolder::DatamodelDefinitionHolder ( const DatamodelDefinitionHolder )
delete

◆ DatamodelDefinitionHolder() [4/4]

podio::DatamodelDefinitionHolder::DatamodelDefinitionHolder ( DatamodelDefinitionHolder &&  )
default

Member Function Documentation

◆ getAvailableDatamodels()

std::vector< std::string > podio::DatamodelDefinitionHolder::getAvailableDatamodels ( ) const

Get all names of the datamodels that have been read from file

Definition at line 40 of file DatamodelRegistryIOHelpers.cc.

40 {
41 std::vector<std::string> defs{};
42 defs.reserve(m_availEDMDefs.size());
43 std::transform(m_availEDMDefs.cbegin(), m_availEDMDefs.cend(), std::back_inserter(defs),
44 [](const auto& elem) { return std::get<0>(elem); });
45
46 return defs;
47}

Referenced by podio::ROOTFrameReader::getAvailableDatamodels(), and podio::SIOFrameReader::getAvailableDatamodels().

◆ getDatamodelDefinition()

const std::string_view podio::DatamodelDefinitionHolder::getDatamodelDefinition ( const std::string &  name) const

Get the datamodel definition for the given datamodel name.

Returns an empty model definition if no model is stored under the given name.

Parameters
nameThe name of the datamodel

Definition at line 29 of file DatamodelRegistryIOHelpers.cc.

29 {
30 const auto it = std::find_if(m_availEDMDefs.cbegin(), m_availEDMDefs.cend(),
31 [&name](const auto& entry) { return std::get<0>(entry) == name; });
32
33 if (it != m_availEDMDefs.cend()) {
34 return std::get<1>(*it);
35 }
36
37 return "{}";
38}

Referenced by podio::ROOTFrameReader::getDatamodelDefinition(), and podio::SIOFrameReader::getDatamodelDefinition().

◆ operator=() [1/2]

DatamodelDefinitionHolder & podio::DatamodelDefinitionHolder::operator= ( const DatamodelDefinitionHolder )
delete

◆ operator=() [2/2]

DatamodelDefinitionHolder & podio::DatamodelDefinitionHolder::operator= ( DatamodelDefinitionHolder &&  )
default

Member Data Documentation

◆ m_availEDMDefs

MapType podio::DatamodelDefinitionHolder::m_availEDMDefs {}
protected

Definition at line 71 of file DatamodelRegistryIOHelpers.h.

Referenced by getAvailableDatamodels(), and getDatamodelDefinition().


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