L1Trigger
RPCTechnicalTrigger
interface
LogicFactory.h
Go to the documentation of this file.
1
#ifndef LOGICFACTORY_H
2
#define LOGICFACTORY_H 1
3
4
// Include files
5
#include <cstdlib>
6
#include <string>
7
#include <map>
8
#include <memory>
19
template
<
class
Ilogic,
typename
Identifier,
typename
LogicCreator = Ilogic* (*)()>
20
class
LogicFactory
{
21
public
:
22
bool
Register
(
const
Identifier&
id
, LogicCreator creator) {
23
return
m_associations
.insert(
typename
std::map<Identifier, LogicCreator>::value_type
(
id
, creator)).second;
24
}
25
26
bool
Unregister
(
const
Identifier&
id
) {
return
m_associations
.erase(
id
) == 1; }
27
28
std::unique_ptr<Ilogic>
CreateObject
(
const
Identifier&
id
)
const
{
29
auto
itr
=
m_associations
.find(
id
);
30
31
if
(
itr
!=
m_associations
.end()) {
32
return
std::unique_ptr<Ilogic>{(
itr
->second)()};
33
}
else
34
return
nullptr
;
// handle error
35
}
36
37
protected
:
38
private
:
39
typename
std::map<Identifier, LogicCreator>
m_associations
;
40
};
41
#endif // LOGICFACTORY_H
LogicFactory::Unregister
bool Unregister(const Identifier &id)
Definition:
LogicFactory.h:26
LogicFactory::m_associations
std::map< Identifier, LogicCreator > m_associations
Definition:
LogicFactory.h:39
LogicFactory::CreateObject
std::unique_ptr< Ilogic > CreateObject(const Identifier &id) const
Definition:
LogicFactory.h:28
LogicFactory::Register
bool Register(const Identifier &id, LogicCreator creator)
Definition:
LogicFactory.h:22
LogicFactory
Definition:
LogicFactory.h:20
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
itr
std::vector< std::pair< float, float > >::iterator itr
Definition:
HGCDigitizer.cc:29
Generated for CMSSW Reference Manual by
1.8.16