LArOpenCV  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
larcv::ImageClusterFactory Class Reference

Factory class for instantiating algorithm instance by larcv::ImageClusterManager This factory class can instantiate a specified algorithm instance w/ provided instance name. More...

#include <ImageClusterFactory.h>

Inheritance diagram for larcv::ImageClusterFactory:
larcv::laropencv_base

Public Member Functions

 ImageClusterFactory ()
 Default ctor, shouldn't be used. More...
 
 ~ImageClusterFactory ()
 Default dtor. More...
 
void add_factory (const std::string name, larcv::ImageClusterFactoryBase *factory)
 Factory registration method (should be called by global factory instance in algorithm header) More...
 
ImageClusterBasecreate (const std::string name, const std::string instance_name)
 Factory creation method (should be called by clients, possibly you!) More...
 
const larcv::loggerlogger () const
 Logger getter. More...
 
void set_verbosity (::larcv::msg::Level_t level)
 Verbosity level. More...
 

Static Public Member Functions

static ImageClusterFactoryget ()
 Static sharable instance getter. More...
 

Private Attributes

std::map< std::string,
larcv::ImageClusterFactoryBase * > 
_factory_map
 Static factory container. More...
 

Static Private Attributes

static ImageClusterFactory_me = nullptr
 Static self. More...
 

Detailed Description

Factory class for instantiating algorithm instance by larcv::ImageClusterManager This factory class can instantiate a specified algorithm instance w/ provided instance name.


The actual factory core (to which each algorithm must register creation factory instance) is
a static std::map. Use static method to get a static instance (larcv::ImageClusterFactory::get)
to access a factory.

Definition at line 47 of file ImageClusterFactory.h.

Constructor & Destructor Documentation

larcv::ImageClusterFactory::ImageClusterFactory ( )
inline

Default ctor, shouldn't be used.

Definition at line 51 of file ImageClusterFactory.h.

References LARCV_WARNING.

Referenced by get().

51  : laropencv_base("ImageClusterFactory")
52  {LARCV_WARNING((*this)) << "To have a factory access static object via ImageClusterFactory::get()!" << std::endl;}
larcv::ImageClusterFactory::~ImageClusterFactory ( )
inline

Default dtor.

Definition at line 54 of file ImageClusterFactory.h.

References _factory_map.

54 {_factory_map.clear();}

Member Function Documentation

void larcv::ImageClusterFactory::add_factory ( const std::string  name,
larcv::ImageClusterFactoryBase factory 
)
inline

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

Definition at line 59 of file ImageClusterFactory.h.

References _factory_map.

Referenced by larcv::EmptyImageClusterFactory::EmptyImageClusterFactory(), larcv::SBClusterFactory::SBClusterFactory(), and larcv::ToyImageClusterFactory::ToyImageClusterFactory().

60  { _factory_map[name] = factory; }
ImageClusterBase* larcv::ImageClusterFactory::create ( const std::string  name,
const std::string  instance_name 
)
inline

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

Definition at line 62 of file ImageClusterFactory.h.

References _factory_map, and LARCV_ERROR.

62  {
63  auto iter = _factory_map.find(name);
64  if(iter == _factory_map.end() || !((*iter).second)) {
65  LARCV_ERROR((*this)) << "Found no registered class " << name << std::endl;
66  return nullptr;
67  }
68  return (*iter).second->create(instance_name);
69  }
static ImageClusterFactory& larcv::ImageClusterFactory::get ( )
inlinestatic
const larcv::logger& larcv::laropencv_base::logger ( ) const
inlineinherited

Logger getter.

Definition at line 43 of file laropencv_base.h.

References larcv::laropencv_base::_logger.

Referenced by larcv::ImageClusterManager::Configure().

44  { return *_logger; }
void larcv::laropencv_base::set_verbosity ( ::larcv::msg::Level_t  level)
inlineinherited

Verbosity level.

Definition at line 47 of file laropencv_base.h.

References larcv::laropencv_base::_logger.

Referenced by larcv::ImageClusterBase::Configure(), and larcv::ImageClusterManager::Configure().

48  { _logger->set(level); }

Member Data Documentation

std::map<std::string,larcv::ImageClusterFactoryBase*> larcv::ImageClusterFactory::_factory_map
private

Static factory container.

Definition at line 72 of file ImageClusterFactory.h.

Referenced by add_factory(), create(), and ~ImageClusterFactory().

larcv::ImageClusterFactory * larcv::ImageClusterFactory::_me = nullptr
staticprivate

Static self.

Definition at line 74 of file ImageClusterFactory.h.

Referenced by get().


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