The Gaudi Framework  master (53935a5b)
Loading...
Searching...
No Matches
DODBasicMapper.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11
12// Framework includes
14#include <GaudiKernel/AlgTool.h>
15#include <GaudiKernel/HashMap.h>
18
26class DODBasicMapper : public extends<AlgTool, IDODAlgMapper, IDODNodeMapper> {
27public:
29 using extends::extends;
30
32 Gaudi::Utils::TypeNameString algorithmForPath( const std::string& path ) override;
33
35 std::string nodeTypeForPath( const std::string& path ) override;
36
37private:
38 template <class T>
40
42 this, "Nodes", {}, "map of the type of nodes to be associated to paths (path -> data_type)." };
44 this, "Algorithms", {}, "map of algorithms to be used to produce entries (path -> alg_name)." };
45};
46
47// Local implementation of parsers from HashMap
48namespace Gaudi {
49 namespace Parsers {
52 template <typename K, typename V>
53 StatusCode parse( GaudiUtils::HashMap<K, V>& result, std::string_view input ) {
54 std::map<std::string, std::string> tmp;
55 StatusCode sc = parse( tmp, input );
56 if ( sc.isSuccess() ) {
57 result.clear();
58 result.insert( tmp.begin(), tmp.end() );
59 }
60 return sc;
61 }
62 } // namespace Parsers
63} // namespace Gaudi
64
66
67Gaudi::Utils::TypeNameString DODBasicMapper::algorithmForPath( const std::string& path ) {
68 auto alg = m_algMap.find( path );
69 return ( alg != m_algMap.end() ) ? alg->second : "";
70}
71
72std::string DODBasicMapper::nodeTypeForPath( const std::string& path ) {
73 auto node = m_nodeMap.find( path );
74 return ( node != m_nodeMap.end() ) ? node->second : "";
75}
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
#define DECLARE_COMPONENT(type)
Default implementation of a DataOnDemand mapper.
MapProp< std::string > m_nodeMap
std::string nodeTypeForPath(const std::string &path) override
Gaudi::Property< GaudiUtils::HashMap< std::string, T > > MapProp
Gaudi::Utils::TypeNameString algorithmForPath(const std::string &path) override
MapProp< Gaudi::Utils::TypeNameString > m_algMap
Implementation of property with value of concrete type.
Definition Property.h:35
Helper class to parse a string of format "type/name".
Common class providing an architecture-independent hash map.
Definition HashMap.h:80
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
bool isSuccess() const
Definition StatusCode.h:302
Base class used to extend a class implementing other interfaces.
Definition extends.h:19
StatusCode parse(GaudiUtils::HashMap< K, V > &result, std::string_view input)
Basic parser for the types of HashMap used in DODBasicMapper.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
STL namespace.