Classes | Namespaces | Macros | Functions
NamedFactory.h File Reference
#include <vector>
#include "WireCellUtil/IFactory.h"
#include "WireCellUtil/Singleton.h"
#include "WireCellUtil/PluginManager.h"
#include "WireCellUtil/Type.h"
#include "WireCellUtil/String.h"
#include "WireCellUtil/Exceptions.h"
#include "WireCellUtil/Logging.h"
#include <unordered_map>
#include <iostream>
#include <exception>
#include <string>
#include <set>

Go to the source code of this file.

Classes

struct  WireCell::FactoryException
 
class  WireCell::NamedFactory< Type >
 
class  WireCell::NamedFactoryRegistry< IType >
 

Namespaces

 WireCell
 
 WireCell::Factory
 Singleton interface.
 

Macros

#define WIRECELL_FACTORY(NAME, CONCRETE, ...)
 

Functions

template<class IType >
bool WireCell::Factory::associate (const std::string &classname, WireCell::INamedFactory *factory)
 Associate a factory with the type it makes. More...
 
template<class IType >
WireCell::INamedFactoryWireCell::Factory::lookup_factory (const std::string &classname)
 Lookup up a factory for the given type. More...
 
template<class IType >
std::shared_ptr< IType > WireCell::Factory::lookup (const std::string &classname, const std::string &instname="", bool create=true, bool nullok=false)
 
template<class IType >
std::shared_ptr< IType > WireCell::Factory::find (const std::string &classname, const std::string &instname="")
 
template<class IType >
std::shared_ptr< IType > WireCell::Factory::find_maybe (const std::string &classname, const std::string &instname="")
 As above but quietly returns nullptr on failure. More...
 
template<class IType >
std::shared_ptr< IType > WireCell::Factory::lookup_tn (const std::string &tn, bool create=true, bool nullok=false)
 Lookup an interface by a type:name pair. More...
 
template<class IType >
std::shared_ptr< IType > WireCell::Factory::find_tn (const std::string &tn)
 Like lookup_tn but with create false. More...
 
template<class IType >
std::shared_ptr< IType > WireCell::Factory::find_maybe_tn (const std::string &tn)
 Like find_tn but with nullok true. More...
 
template<class IType >
std::vector< std::stringWireCell::Factory::known_classes ()
 Return a vector of all known classes of given interface. More...
 
template<class IType >
std::vector< std::stringWireCell::Factory::known_types ()
 
template<class Concrete , class... Interface>
void * make_named_factory_factory (std::string name)
 
template<class Concrete , class... Interface>
size_t namedfactory_hello (std::string name)
 

Macro Definition Documentation

#define WIRECELL_FACTORY (   NAME,
  CONCRETE,
  ... 
)
Value:
static size_t hello_##NAME##_me = namedfactory_hello< CONCRETE , __VA_ARGS__ >(#NAME); \
extern "C" { void* make_##NAME##_factory() { \
return make_named_factory_factory< CONCRETE , __VA_ARGS__ >(#NAME); \
}}

Definition at line 332 of file NamedFactory.h.

Function Documentation

template<class Concrete , class... Interface>
void* make_named_factory_factory ( std::string  name)

Definition at line 311 of file NamedFactory.h.

311  {
312  static void* void_factory = nullptr;
313  if (! void_factory) {
314  void_factory = new WireCell::NamedFactory<Concrete>;
316  = reinterpret_cast< WireCell::NamedFactory< Concrete >* >(void_factory);
317  std::vector<bool> ret{WireCell::Factory::associate<Interface>(name, factory)...};
318  }
319  return void_factory;
320 }
static QCString name
Definition: declinfo.cpp:673
template<class Concrete , class... Interface>
size_t namedfactory_hello ( std::string  name)

Definition at line 324 of file NamedFactory.h.

325 {
326  std::vector<size_t> ret{WireCell::Singleton< WireCell::NamedFactoryRegistry<Interface> >::Instance().hello(name)...};
327  return ret.size();
328 }
static QCString name
Definition: declinfo.cpp:673