Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
SimG4Core
Notification
interface
ComponentFactoryByName.h
Go to the documentation of this file.
1
#ifndef SimG4Core_ComponentFactoryByName_H
2
#define SimG4Core_ComponentFactoryByName_H
3
4
#include "
SimG4Core/Notification/interface/SimG4Exception.h
"
5
6
#include <string>
7
#include <map>
8
9
template
<
class
B>
10
class
ComponentFactoryByName
11
{
12
public
:
13
static
B
*
getBuilder
(
const
std::string
&
name
)
14
{
15
if
(
myMap
().
size
() == 0)
16
throw
SimG4Exception
(
"No Builder registered to the Factory."
);
17
if
(
myMap
().
find
(name) ==
myMap
().
end
())
18
throw
SimG4Exception
(
"The Component "
+name+
" is not registered to the Factory."
);
19
return
(
myMap
()[name]);
20
}
21
static
void
setBuilder
(
B
*
in
,
const
std::string
&
name
)
22
{
23
if
(name.empty())
24
throw
SimG4Exception
(
"The registration of Components without name is not allowed."
);
25
myMap
()[
name
] =
in
;
26
}
27
typedef
std::map<std::string,B *>
BuilderMapType
;
28
protected
:
29
static
BuilderMapType
&
myMap
()
30
{
31
static
BuilderMapType
me_;
32
return
me_;
33
}
34
};
35
36
#endif
37
38
39
ComponentFactoryByName::getBuilder
static B * getBuilder(const std::string &name)
Definition:
ComponentFactoryByName.h:13
recoMuon::in
Definition:
RecoMuonEnumerators.h:6
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition:
FindCaloHit.cc:7
mergeVDriftHistosByStation.name
string name
Definition:
mergeVDriftHistosByStation.py:77
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
double_binary
Definition:
DDStreamer.cc:227
ComponentFactoryByName::myMap
static BuilderMapType & myMap()
Definition:
ComponentFactoryByName.h:29
end
#define end
Definition:
vmac.h:37
ComponentFactoryByName::BuilderMapType
std::map< std::string, B * > BuilderMapType
Definition:
ComponentFactoryByName.h:27
SimG4Exception
Definition:
SimG4Exception.h:13
SimG4Exception.h
ComponentFactoryByName::setBuilder
static void setBuilder(B *in, const std::string &name)
Definition:
ComponentFactoryByName.h:21
ComponentFactoryByName
Definition:
ComponentFactoryByName.h:10
findQualityFiles.size
tuple size
Write out results.
Definition:
findQualityFiles.py:442
Generated for CMSSW Reference Manual by
1.8.5