| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

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

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

## Functions
GAUDIPS_API void * | getCreator (const std::string &id, const std::string &type)
| Function used to load a specific factory function.
template<typename F >
F | getCreator (const std::string &id)
| Convoluted implementation of getCreator with an embedded reinterpret_cast, used to avoid the warning <verbatim> warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object </verbatim> It is an ugly trick but works.
GAUDIPS_API std::string | demangle (const std::type_info &id)
| Return a canonical name for type_info object (implementation borrowed from GaudiKernel/System).
template<typename T >
std::string | demangle ()
| Return a canonical name for the template argument.
GAUDIPS_API Logger & | logger ()
| Return the current logger instance.
GAUDIPS_API void | setLogger (Logger *logger)
| Set the logger instance to use.
static std::auto_ptr< Logger > | s_logger (new Logger)

## 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 329 of file PluginService.cpp.

{
int status;
char* realname;
realname = abi::__cxa_demangle(id.name(), 0, 0, &status);
if (realname == 0) return id.name();
std::string result(realname);
free(realname);
return result;
}
template<typename T >

std::string Gaudi::PluginService::Details::demangle | ( |  | ) |
| inline

Return a canonical name for the template argument.

Definition at line 113 of file PluginServiceDetails.h.

{ return demangle(typeid(T)); }

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.

{
return Registry::instance().get(id, type);
}
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 <verbatim> warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object </verbatim> It is an ugly trick but works.

See:

- http://www.trilithium.com/johan/2004/12/problem-with-dlsym/
- http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#573
- http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195

Definition at line 100 of file PluginServiceDetails.h.

{
union { void* src; F dst; } p2p;
p2p.src = getCreator(id, typeid(F).name());
return p2p.dst;
}

Logger & Gaudi::PluginService::Details::logger | ( |  | ) |

Return the current logger instance.

Definition at line 350 of file PluginService.cpp.

{
return *s_logger;
}

static std::auto_ptr<Logger> Gaudi::PluginService::Details::s_logger | ( | new | Logger | ) |
| static

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 353 of file PluginService.cpp.

{
s_logger.reset(logger);
}