All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gaudi::PluginService::Details Namespace Reference

Classes

class  Factory
 Class providing default factory functions. More...
 
class  Logger
 Simple logging class, just to provide a default implementation. More...
 
class  Registry
 In-memory database of the loaded factories. More...
 

Functions

GAUDIPS_API void * getCreator (const std::string &id, const std::string &type)
 Function used to load a specific factory function. More...
 
template<typename F >
getCreator (const std::string &id)
 Convoluted implementation of getCreator with an embedded reinterpret_cast, used to avoid the warning. More...
 
GAUDIPS_API std::string demangle (const std::type_info &id)
 Return a canonical name for type_info object (implementation borrowed from GaudiKernel/System). More...
 
template<typename T >
std::string demangle ()
 Return a canonical name for the template argument. More...
 
GAUDIPS_API Loggerlogger ()
 Return the current logger instance. More...
 
GAUDIPS_API void setLogger (Logger *logger)
 Set the logger instance to use. More...
 
std::string demangle (const std::string &id)
 

Function Documentation

std::string Gaudi::PluginService::Details::demangle ( const std::type_info &  id)

Return a canonical name for type_info object (implementation borrowed from GaudiKernel/System).

Definition at line 132 of file PluginService.cpp.

132  {
133  return demangle(id.name());
134  }
std::string demangle(const std::string &id)
template<typename T >
std::string Gaudi::PluginService::Details::demangle ( )
inline

Return a canonical name for the template argument.

Definition at line 96 of file PluginServiceDetails.h.

96 { return demangle(typeid(T)); }
std::string demangle()
Return a canonical name for the template argument.
std::string Gaudi::PluginService::Details::demangle ( const std::string &  id)

Definition at line 123 of file PluginService.cpp.

123  {
124  int status;
125  char* realname;
126  realname = abi::__cxa_demangle(id.c_str(), 0, 0, &status);
127  if (realname == 0) return id;
128  std::string result(realname);
129  free(realname);
130  return result;
131  }
void * Gaudi::PluginService::Details::getCreator ( const std::string &  id,
const std::string &  type 
)

Function used to load a specific factory function.

Returns
the pointer to the factory function.

Definition at line 119 of file PluginService.cpp.

119  {
120  return Registry::instance().get(id, type);
121  }
string type
Definition: gaudirun.py:126
template<typename F >
F Gaudi::PluginService::Details::getCreator ( const std::string &  id)
inline

Convoluted implementation of getCreator with an embedded reinterpret_cast, used to avoid the warning.

warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object

It is an ugly trick but works.
See:

Definition at line 83 of file PluginServiceDetails.h.

83  {
84  union { void* src; F dst; } p2p;
85  p2p.src = getCreator(id, typeid(F).name());
86  return p2p.dst;
87  }
F getCreator(const std::string &id)
Convoluted implementation of getCreator with an embedded reinterpret_cast, used to avoid the warning...
Logger & Gaudi::PluginService::Details::logger ( )

Return the current logger instance.

Definition at line 353 of file PluginService.cpp.

353  {
354  return *s_logger;
355  }
void Gaudi::PluginService::Details::setLogger ( Logger *  logger)

Set the logger instance to use.

It must be a new instance and the ownership is passed to the function.

Definition at line 356 of file PluginService.cpp.

356  {
357  s_logger.reset(logger);
358  }
GAUDIPS_API Logger & logger()
Return the current logger instance.