Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
protoduneana
protoduneana
Utilities
FitUtils
ThinSliceDriverRegistry.cxx
Go to the documentation of this file.
1
#include "
ThinSliceDriverRegistry.h
"
2
#include "
ThinSliceDriver.h
"
3
#include "
ThinSliceDriverFactory.h
"
4
5
#include <iostream>
6
#include <stdexcept>
7
8
protoana::ThinSliceDriverRegistry
*
protoana::ThinSliceDriverRegistry::fInstance
= 0;
9
10
protoana::ThinSliceDriverRegistry
*
protoana::ThinSliceDriverRegistry::Instance
() {
11
if
(!
fInstance
) {
12
static
protoana::ThinSliceDriverRegistry
* manager_ptr = 0 ;
13
if
(!manager_ptr) {
14
manager_ptr =
new
protoana::ThinSliceDriverRegistry
;
15
}
16
protoana::ThinSliceDriverRegistry
& manager = * manager_ptr;
17
fInstance
= & manager;
18
}
19
return
fInstance
;
20
}
21
22
protoana::ThinSliceDriverRegistry::ThinSliceDriverRegistry
() {}
23
24
protoana::ThinSliceDriverRegistry::~ThinSliceDriverRegistry
() {
25
//Clean();
26
}
27
28
void
protoana::ThinSliceDriverRegistry::PrintAvailableDrivers
()
const
{
29
std::cout <<
"####ThinSliceDriverRegistry####"
<<
std::endl
;
30
std::cout <<
"Available Drivers:"
<<
std::endl
;
31
for
(
auto
it =
fFactories
.begin(); it !=
fFactories
.end(); ++it) {
32
std::cout <<
"Driver: "
<< it->first <<
std::endl
;
33
}
34
std::cout <<
"###############################"
<< std::endl <<
std::endl
;
35
}
36
37
void
protoana::ThinSliceDriverRegistry::AddFactory
(
38
std::string
name
,
protoana::BaseThinSliceDriverFactory
* factory) {
39
fFactories
[
name
] = factory;
40
}
41
42
protoana::ThinSliceDriver
*
protoana::ThinSliceDriverRegistry::GetDriver
(
43
const
std::string
&
name
,
44
const
fhicl::ParameterSet
& extra_options) {
45
if
(
fFactories
.find(name) ==
fFactories
.end()) {
46
std::string
message
=
"Could not find ThinSliceDriver of type: "
+
47
name
;
48
throw
std::runtime_error(message);
49
}
50
else
{
51
return
fFactories
[
name
]->Instantiate(extra_options);
52
}
53
}
name
static QCString name
Definition:
declinfo.cpp:673
string
std::string string
Definition:
nybbler.cc:12
protoana::ThinSliceDriverRegistry::AddFactory
void AddFactory(std::string name, BaseThinSliceDriverFactory *factory)
Definition:
ThinSliceDriverRegistry.cxx:37
ThinSliceDriverFactory.h
protoana::BaseThinSliceDriverFactory
Definition:
ThinSliceDriverFactory.h:10
protoana::ThinSliceDriverRegistry
Definition:
ThinSliceDriverRegistry.h:12
protoana::ThinSliceDriverRegistry::PrintAvailableDrivers
void PrintAvailableDrivers() const
Definition:
ThinSliceDriverRegistry.cxx:28
python.root_metadata.message
message
Definition:
root_metadata.py:29
protoana::ThinSliceDriverRegistry::~ThinSliceDriverRegistry
~ThinSliceDriverRegistry()
Definition:
ThinSliceDriverRegistry.cxx:24
protoana::ThinSliceDriver
Definition:
ThinSliceDriver.h:19
ThinSliceDriver.h
protoana::ThinSliceDriverRegistry::Instance
static ThinSliceDriverRegistry * Instance()
Definition:
ThinSliceDriverRegistry.cxx:10
ThinSliceDriverRegistry.h
protoana::ThinSliceDriverRegistry::fFactories
std::map< std::string, BaseThinSliceDriverFactory * > fFactories
Definition:
ThinSliceDriverRegistry.h:25
protoana::ThinSliceDriverRegistry::ThinSliceDriverRegistry
ThinSliceDriverRegistry()
Definition:
ThinSliceDriverRegistry.cxx:22
protoana::ThinSliceDriverRegistry::fInstance
static ThinSliceDriverRegistry * fInstance
Definition:
ThinSliceDriverRegistry.h:24
protoana::ThinSliceDriverRegistry::GetDriver
ThinSliceDriver * GetDriver(const std::string &name, const fhicl::ParameterSet &extra_options)
Definition:
ThinSliceDriverRegistry.cxx:42
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11