Go to the documentation of this file.
   11 #ifndef _GAUDI_PLUGIN_SERVICE_DETAILS_V1_H_ 
   12 #define _GAUDI_PLUGIN_SERVICE_DETAILS_V1_H_ 
   28   namespace PluginService {
 
   38           template <
typename S, 
typename... Args>
 
   40             return new T( std::forward<Args>( 
args )... );
 
   93                 : library( 
std::move( lib ) )
 
   96                 , rtype( 
std::move( rt ) )
 
   97                 , className( 
std::move( cn ) )
 
  120           template <
typename F, 
typename T, 
typename I>
 
  123               typename F::FuncType src;
 
  129             return add( o.
str(), p2p.dst, 
typeid( 
typename F::FuncType ).name(),
 
  130                         typeid( 
typename F::ReturnType ).name(), demangle<T>() );
 
  137           const FactoryInfo& getInfo( 
const std::string& 
id ) 
const;
 
  147             if ( !m_initialized ) 
const_cast<Registry*
>( this )->initialize();
 
  167             if ( !m_initialized ) initialize();
 
  218 #define _PS_V1_INTERNAL_FACTORY_REGISTER_CNAME( name, serial ) _register_##_##serial 
  220 #define _PS_V1_INTERNAL_DECLARE_FACTORY_WITH_CREATOR( type, typecreator, id, factory, serial )                         \ 
  222     class _PS_V1_INTERNAL_FACTORY_REGISTER_CNAME( type, serial ) {                                                     \ 
  224       typedef factory      s_t;                                                                                        \ 
  225       typedef typecreator  f_t;                                                                                        \ 
  226       static s_t::FuncType creator() { return &f_t::create<s_t>; }                                                     \ 
  227       _PS_V1_INTERNAL_FACTORY_REGISTER_CNAME( type, serial )() {                                                       \ 
  228         using ::Gaudi::PluginService::v1::Details::Registry;                                                           \ 
  229         Registry::instance().add<s_t, type>( id, creator() );                                                          \ 
  231     } _PS_V1_INTERNAL_FACTORY_REGISTER_CNAME( s_##type, serial );                                                      \ 
  234 #define _PS_V1_INTERNAL_DECLARE_FACTORY( type, id, factory, serial )                                                   \ 
  235   _PS_V1_INTERNAL_DECLARE_FACTORY_WITH_CREATOR( type, ::Gaudi::PluginService::v1::Details::Factory<type>, id, factory, \ 
  238 #endif //_GAUDI_PLUGIN_SERVICE_DETAILS_H_ 
  
 
static S::ReturnType create(Args &&... args)
In-memory database of the loaded factories.
std::recursive_mutex m_mutex
Mutex used to control concurrent access to the internal data.
void error(const std::string &msg)
void debug(const std::string &msg)
get
decorate the vector of properties
GAUDIPS_API void * getCreator(const std::string &id, const std::string &type)
Function used to load a specific factory function.
Class providing default factory functions.
FactoryMap m_factories
Internal storage for factories.
bool m_initialized
Flag recording if the registry has been initialized or not.
GAUDIPS_API void setLogger(Logger *logger)
Set the logger instance to use.
void info(const std::string &msg)
void setLevel(Level level)
Logger(Level level=Warning)
FactoryMap & factories()
Return the known factories (loading the list if not yet done).
std::map< KeyType, std::string > Properties
Type used for the properties implementation.
const FactoryMap & factories() const
Return the known factories (loading the list if not yet done).
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
GAUDIPS_API void SetDebug(int debugLevel)
Backward compatibility with Reflex.
std::map< KeyType, FactoryInfo > FactoryMap
Type used for the database implementation.
#define GAUDI_PLUGIN_SERVICE_V1_INLINE
FactoryInfo & add(const I &id, typename F::FuncType ptr)
Add a factory to the database.
FactoryInfo & addProperty(const KeyType &k, std::string v)
GAUDIPS_API Logger & logger()
Return the current logger instance.
GAUDIPS_API int Debug()
Backward compatibility with Reflex.
FactoryInfo(std::string lib, void *p=nullptr, std::string t="", std::string rt="", std::string cn="", Properties props=Properties())
GAUDIPS_API std::string demangle(const std::type_info &id)
Return a canonical name for type_info object (implementation borrowed from GaudiKernel/System).
Registry(const Registry &)
Private copy constructor for the singleton pattern.
Simple logging class, just to provide a default implementation.
void warning(const std::string &msg)