Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
protoana::ThinSliceDriverRegistry Class Reference

#include <ThinSliceDriverRegistry.h>

Public Member Functions

 ~ThinSliceDriverRegistry ()
 
void AddFactory (std::string name, BaseThinSliceDriverFactory *factory)
 
void PrintAvailableDrivers () const
 
ThinSliceDriverGetDriver (const std::string &name, const fhicl::ParameterSet &extra_options)
 

Static Public Member Functions

static ThinSliceDriverRegistryInstance ()
 

Private Member Functions

 ThinSliceDriverRegistry ()
 

Private Attributes

std::map< std::string, BaseThinSliceDriverFactory * > fFactories
 

Static Private Attributes

static ThinSliceDriverRegistryfInstance = 0
 

Detailed Description

Definition at line 12 of file ThinSliceDriverRegistry.h.

Constructor & Destructor Documentation

protoana::ThinSliceDriverRegistry::~ThinSliceDriverRegistry ( )

Definition at line 24 of file ThinSliceDriverRegistry.cxx.

24  {
25  //Clean();
26 }
protoana::ThinSliceDriverRegistry::ThinSliceDriverRegistry ( )
private

Definition at line 22 of file ThinSliceDriverRegistry.cxx.

22 {}

Member Function Documentation

void protoana::ThinSliceDriverRegistry::AddFactory ( std::string  name,
protoana::BaseThinSliceDriverFactory factory 
)

Definition at line 37 of file ThinSliceDriverRegistry.cxx.

38  {
39  fFactories[name] = factory;
40 }
static QCString name
Definition: declinfo.cpp:673
std::map< std::string, BaseThinSliceDriverFactory * > fFactories
protoana::ThinSliceDriver * protoana::ThinSliceDriverRegistry::GetDriver ( const std::string name,
const fhicl::ParameterSet extra_options 
)

Definition at line 42 of file ThinSliceDriverRegistry.cxx.

44  {
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 }
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
std::map< std::string, BaseThinSliceDriverFactory * > fFactories
protoana::ThinSliceDriverRegistry * protoana::ThinSliceDriverRegistry::Instance ( void  )
static

Definition at line 10 of file ThinSliceDriverRegistry.cxx.

10  {
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 }
static ThinSliceDriverRegistry * fInstance
void protoana::ThinSliceDriverRegistry::PrintAvailableDrivers ( ) const

Definition at line 28 of file ThinSliceDriverRegistry.cxx.

28  {
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 }
std::map< std::string, BaseThinSliceDriverFactory * > fFactories
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::map<std::string, BaseThinSliceDriverFactory *> protoana::ThinSliceDriverRegistry::fFactories
private

Definition at line 25 of file ThinSliceDriverRegistry.h.

protoana::ThinSliceDriverRegistry * protoana::ThinSliceDriverRegistry::fInstance = 0
staticprivate

Definition at line 24 of file ThinSliceDriverRegistry.h.


The documentation for this class was generated from the following files: