15 return registryInstance;
19 const auto it = std::find_if(m_definitions.cbegin(), m_definitions.cend(),
20 [&name](
const auto& kvPair) { return kvPair.first == name; });
22 if (it == m_definitions.cend()) {
23 int index = m_definitions.size();
24 m_definitions.emplace_back(name, definition);
29 return std::distance(m_definitions.cbegin(), it);
33 const auto it = std::find_if(m_definitions.cbegin(), m_definitions.cend(),
34 [&name](
const auto& kvPair) { return kvPair.first == name; });
35 if (it == m_definitions.cend()) {
36 std::cerr <<
"PODIO WARNING: Cannot find the definition for the EDM with the name " << name << std::endl;
37 static constexpr std::string_view emptyDef =
"{}";
45 if (index >= m_definitions.size()) {
46 std::cerr <<
"PODIO WARNING: Cannot find the definition for the EDM with the index " << index << std::endl;
47 static constexpr std::string_view emptyDef =
"{}";
51 return m_definitions[index].second;
55 if (index >= m_definitions.size()) {
56 std::cout <<
"PODIO WARNING: Cannot find the name of the EDM with the index " << index << std::endl;
57 static const std::string emptyName =
"";
60 return m_definitions[index].first;
static const DatamodelRegistry & instance()
Get the registry.
static DatamodelRegistry & mutInstance()
const std::string & getDatamodelName(size_t index) const
size_t registerDatamodel(std::string name, std::string_view definition)
const std::string_view getDatamodelDefinition(std::string_view name) const