All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
lightana::FlashAlgoFactory Class Reference

Factory class for instantiating flash algorithm instance. More...

#include <FlashAlgoFactory.h>

Public Member Functions

 ~FlashAlgoFactory ()
 Default dtor. More...
 
void add_factory (const std::string name, lightana::FlashAlgoFactoryBase *factory)
 Factory registration method (should be called by global factory instance in algorithm header) More...
 
FlashAlgoBase * create (const std::string name, const std::string instance_name)
 Factory creation method (should be called by clients, possibly you!) More...
 

Static Public Member Functions

static FlashAlgoFactory & get ()
 Static sharable instance getter. More...
 

Private Member Functions

 FlashAlgoFactory ()
 Default ctor, shouldn't be used. More...
 

Private Attributes

std::map< std::string,
lightana::FlashAlgoFactoryBase * > 
_factory_map
 Static factory container. More...
 

Static Private Attributes

static FlashAlgoFactory * _me = nullptr
 Static self. More...
 

Detailed Description

Factory class for instantiating flash algorithm instance.

Definition at line 42 of file sbndcode/sbndcode/OpDetReco/OpFlash/FlashFinder/FlashAlgoFactory.h.

Constructor & Destructor Documentation

lightana::FlashAlgoFactory::FlashAlgoFactory ( )
inlineprivate

Default ctor, shouldn't be used.

Definition at line 45 of file sbndcode/sbndcode/OpDetReco/OpFlash/FlashFinder/FlashAlgoFactory.h.

45 {}
lightana::FlashAlgoFactory::~FlashAlgoFactory ( )
inline

Default dtor.

Definition at line 48 of file sbndcode/sbndcode/OpDetReco/OpFlash/FlashFinder/FlashAlgoFactory.h.

48 {_factory_map.clear();}
std::map< std::string, lightana::FlashAlgoFactoryBase * > _factory_map
Static factory container.

Member Function Documentation

void lightana::FlashAlgoFactory::add_factory ( const std::string  name,
lightana::FlashAlgoFactoryBase *  factory 
)
inline

Factory registration method (should be called by global factory instance in algorithm header)

Definition at line 53 of file sbndcode/sbndcode/OpDetReco/OpFlash/FlashFinder/FlashAlgoFactory.h.

54  { _factory_map[name] = factory; }
std::map< std::string, lightana::FlashAlgoFactoryBase * > _factory_map
Static factory container.
then echo fcl name
FlashAlgoBase* lightana::FlashAlgoFactory::create ( const std::string  name,
const std::string  instance_name 
)
inline

Factory creation method (should be called by clients, possibly you!)

Definition at line 56 of file sbndcode/sbndcode/OpDetReco/OpFlash/FlashFinder/FlashAlgoFactory.h.

56  {
57  auto iter = _factory_map.find(name);
58  if(iter == _factory_map.end() || !((*iter).second)) {
59  std::cerr << "Found no registered class " << name << std::endl;
60  return nullptr;
61  }
62  auto ptr = (*iter).second->create(instance_name);
63  return ptr;
64  }
BEGIN_PROLOG could also be cerr
std::map< std::string, lightana::FlashAlgoFactoryBase * > _factory_map
Static factory container.
then echo fcl name
static FlashAlgoFactory& lightana::FlashAlgoFactory::get ( )
inlinestatic

Static sharable instance getter.

Definition at line 50 of file sbndcode/sbndcode/OpDetReco/OpFlash/FlashFinder/FlashAlgoFactory.h.

Member Data Documentation

std::map<std::string,lightana::FlashAlgoFactoryBase*> lightana::FlashAlgoFactory::_factory_map
private

Static factory container.

Definition at line 68 of file sbndcode/sbndcode/OpDetReco/OpFlash/FlashFinder/FlashAlgoFactory.h.

lightana::FlashAlgoFactory * lightana::FlashAlgoFactory::_me = nullptr
staticprivate

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