All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DODBasicMapper.cpp
Go to the documentation of this file.
1 // Include files
2 
3 #include "GaudiKernel/HashMap.h"
4 #include "GaudiKernel/Parsers.h"
5 // Local implementation of parsers from HashMap
6 namespace Gaudi {
7  namespace Parsers {
10  template <typename K, typename V>
11  StatusCode parse(GaudiUtils::HashMap<K, V> &result, const std::string &input) {
12  std::map<std::string, std::string> tmp;
13  StatusCode sc = parse(tmp, input);
14  if (sc.isSuccess()) {
15  result.clear();
16  result.insert(tmp.begin(), tmp.end());
17  }
18  return sc;
19  }
20  }
21 }
22 
23 // From Gaudi
25 // local
26 #include "DODBasicMapper.h"
27 
28 // ----------------------------------------------------------------------------
29 // Implementation file for class: DODBasicMapper
30 //
31 // 16/01/2012: Marco Clemencic
32 // ----------------------------------------------------------------------------
34 
35 // ============================================================================
36 // Standard constructor, initializes variables
37 // ============================================================================
38 DODBasicMapper::DODBasicMapper(const std::string& type, const std::string& name, const IInterface* parent)
39  : base_class(type, name, parent)
40 {
41  declareProperty("Nodes", m_nodeMap,
42  "Map of the type of nodes to be associated to paths (path -> data_type).");
43  declareProperty("Algorithms", m_algMap,
44  "Map of algorithms to be used to produce entries (path -> alg_name).");
45 }
46 
47 // ============================================================================
48 // Destructor
49 // ============================================================================
51 
52 
54 {
55  AlgMap::iterator alg = m_algMap.find(path);
56  return (alg != m_algMap.end()) ? alg->second : "";
57 }
58 
59 
60 std::string DODBasicMapper::nodeTypeForPath(const std::string & path)
61 {
62  NodeMap::iterator node = m_nodeMap.find(path);
63  return (node != m_nodeMap.end()) ? node->second : "";
64 }
65 
66 
67 
68 // ============================================================================
virtual std::string nodeTypeForPath(const std::string &path)
Default implementation of a DataOnDemand mapper.
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:75
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
std::pair< iterator, bool > insert(const value_type &val)
Definition: Map.h:165
virtual Gaudi::Utils::TypeNameString algorithmForPath(const std::string &path)
iterator end()
Definition: Map.h:131
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
string type
Definition: gaudirun.py:126
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
iterator find(const key_type &key)
Definition: Map.h:148
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Common class providing an architecture-independent hash map.
Definition: HashMap.h:108
void clear()
Definition: Map.h:176
virtual ~DODBasicMapper()
Destructor.
This is a number of static methods for bootstrapping the Gaudi framework.
Definition: Bootstrap.h:14