1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#ifndef DETECTOR_DESCRIPTION_PARSER_DDL_ELEMENT_REGISTRY_H
#define DETECTOR_DESCRIPTION_PARSER_DDL_ELEMENT_REGISTRY_H
#include "DetectorDescription/Core/interface/ClhepEvaluator.h"
#include <CLHEP/Evaluator/Evaluator.h>
#include <string>
#include <map>
#include <memory>
class DDXMLElement;
/// The main class for processing parsed elements.
/** \class DDLElementRegistry
*
* This class is designed to serve as a registry of all DDL XML elements.
*
* This class is responsible for constructing and destructing
* any necessary DDL element.
*
*/
class DDLElementRegistry {
public:
typedef std::map<std::string, std::shared_ptr<DDXMLElement> > RegistryMap;
DDLElementRegistry();
~DDLElementRegistry();
/// This allows other Elements to register themselves with the static registry
void registerElement(const std::string& name, DDXMLElement*);
/// THE most important part. Getting the pointer to a given element type.
/**
* If this is called with a DDXMLElementRegistry pointer, it will simply
* return a pointer if already registered or NULL, no instantiating.
*
*/
std::shared_ptr<DDXMLElement> getElement(const std::string& name);
ClhepEvaluator& evaluator() { return evaluator_; }
private:
RegistryMap registry_;
ClhepEvaluator evaluator_;
};
#endif
|