1 #ifndef _GAUDI_PLUGIN_SERVICE_DETAILS_H_ 2 #define _GAUDI_PLUGIN_SERVICE_DETAILS_H_ 23 #if defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L 28 #define GAUDIPS_HASCLASSVISIBILITY 31 #if defined( GAUDIPS_HASCLASSVISIBILITY ) 32 #define GAUDIPS_IMPORT __attribute__( ( visibility( "default" ) ) ) 33 #define GAUDIPS_EXPORT __attribute__( ( visibility( "default" ) ) ) 34 #define GAUDIPS_LOCAL __attribute__( ( visibility( "hidden" ) ) ) 36 #define GAUDIPS_IMPORT 37 #define GAUDIPS_EXPORT 41 #ifdef GaudiPluginService_EXPORTS 42 #define GAUDIPS_API GAUDIPS_EXPORT 44 #define GAUDIPS_API GAUDIPS_IMPORT 49 namespace PluginService
62 #if !defined( __REFLEX__ ) || defined( ATLAS ) 63 template <
typename S,
typename... Args>
66 return new T( std::forward<Args>(
args )... );
105 template <
typename T>
123 : library(
std::move( lib ) )
125 , type(
std::move( t ) )
126 , rtype(
std::move( rt ) )
127 , className(
std::move( cn ) )
153 template <
typename F,
typename T,
typename I>
157 typename F::FuncType src;
163 return add( o.
str(), p2p.dst,
typeid(
typename F::FuncType ).
name(),
typeid(
typename F::ReturnType ).
name(),
182 if ( !m_initialized )
const_cast<Registry*
>( this )->initialize();
203 if ( !m_initialized ) initialize();
217 #if defined( __GXX_EXPERIMENTAL_CXX0X__ ) || __cplusplus >= 201103L 256 #define _INTERNAL_FACTORY_REGISTER_CNAME( name, serial ) _register_##_##serial 258 #define _INTERNAL_DECLARE_FACTORY_WITH_CREATOR( type, typecreator, id, factory, serial ) \ 261 class _INTERNAL_FACTORY_REGISTER_CNAME( type, serial ) \ 264 typedef factory s_t; \ 265 typedef typecreator f_t; \ 266 static s_t::FuncType creator() { return &f_t::create<s_t>; } \ 267 _INTERNAL_FACTORY_REGISTER_CNAME( type, serial )() \ 269 using ::Gaudi::PluginService::Details::Registry; \ 270 Registry::instance().add<s_t, type>( id, creator() ); \ 272 } _INTERNAL_FACTORY_REGISTER_CNAME( s_##type, serial ); \ 275 #define _INTERNAL_DECLARE_FACTORY( type, id, factory, serial ) \ 276 _INTERNAL_DECLARE_FACTORY_WITH_CREATOR( type, ::Gaudi::PluginService::Details::Factory<type>, id, factory, serial ) 278 #endif //_GAUDI_PLUGIN_SERVICE_DETAILS_H_
void error(const std::string &msg)
Registry(const Registry &)
Private copy constructor for the singleton pattern.
Class providing default factory functions.
FactoryMap & factories()
Return the known factories (loading the list if not yet done).
std::vector< Gaudi::Details::PropertyBase * > Properties
GAUDIPS_API Logger & logger()
Return the current logger instance.
FactoryInfo & addProperty(const KeyType &k, std::string v)
std::map< KeyType, std::string > Properties
Type used for the properties implementation.
Simple logging class, just to provide a default implementation.
static S::ReturnType create(Args &&...args)
GAUDIPS_API void SetDebug(int debugLevel)
Backward compatibility with Reflex.
FactoryInfo(std::string lib, void *p=0, 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).
const FactoryMap & factories() const
Return the known factories (loading the list if not yet done).
void warning(const std::string &msg)
void info(const std::string &msg)
Logger(Level level=Warning)
GAUDIPS_API void * getCreator(const std::string &id, const std::string &type)
Function used to load a specific factory function.
In-memory database of the loaded factories.
FactoryInfo & add(const I &id, typename F::FuncType ptr)
Add a factory to the database.
GAUDIPS_API int Debug()
Backward compatibility with Reflex.
GAUDIPS_API void setLogger(Logger *logger)
Set the logger instance to use.
void setLevel(Level level)
std::map< KeyType, FactoryInfo > FactoryMap
Type used for the database implementation.
FactoryMap m_factories
Internal storage for factories.
Helper functions to set/get the application return code.
bool m_initialized
Flag recording if the registry has been initialized or not.
void debug(const std::string &msg)