| The Gaudi Framework v32r1 (f65d50dc)

Classes | Functions
Gaudi::PluginService::v1::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 >
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 Logger & | logger ()
| 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

## ◆ demangle() [1/3]

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

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

Definition at line 134 of file PluginServiceV1.cpp.

134 { return demangle( id.name() ); }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
Gaudi::PluginService::v1::Details::demangle
std::string demangle(const std::string &id)
Definition: PluginServiceV1.cpp:120

## ◆ demangle() [2/3]

template<typename T >

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

Return a canonical name for the template argument.

Definition at line 78 of file PluginServiceDetailsV1.h.

78 {
79 return demangle( typeid( T ) );
80 }
Gaudi::PluginService::v1::Details::demangle
std::string demangle()
Return a canonical name for the template argument.
Definition: PluginServiceDetailsV1.h:78

## ◆ demangle() [3/3]

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

Definition at line 120 of file PluginServiceV1.cpp.

120 {
121 int status;
122 auto realname = std::unique_ptr<char, decltype( free )*>(
123 abi::__cxa_demangle( id.c_str(), nullptr, nullptr, &status ), free );
124 if ( !realname ) return id;
125 #if _GLIBCXX_USE_CXX11_ABI
126 return std::regex_replace(
127 realname.get(),
128 std::regex{"std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >( (?=>))?"},
129 "std::string" );
130 #else
131 return std::string{realname.get()};
132 #endif
133 }
std::string
STL class.
std::regex_replace
T regex_replace(T... args)
std::unique_ptr
STL class.
std::regex

## ◆ getCreator() [1/2]

void * Gaudi::PluginService::v1::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 116 of file PluginServiceV1.cpp.

116 {
117 return Registry::instance().get( id, type );
118 }
gaudirun.type
type
Definition: gaudirun.py:142

## ◆ getCreator() [2/2]

template<typename F >

F Gaudi::PluginService::v1::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:

- 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 62 of file PluginServiceDetailsV1.h.

62 {
63 union {
64 void* src;
65 F dst;
66 } p2p;
67 p2p.src = getCreator( id, typeid( F ).name() );
68 return p2p.dst;
69 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
Gaudi::PluginService::v1::Details::getCreator
F getCreator(const std::string &id)
Convoluted implementation of getCreator with an embedded reinterpret_cast, used to avoid the warning.
Definition: PluginServiceDetailsV1.h:62
ReadAndWriteWhiteBoard.dst
dst
Definition: ReadAndWriteWhiteBoard.py:17

## ◆ logger()

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

Return the current logger instance.

Definition at line 324 of file PluginServiceV1.cpp.

324 { return *s_logger; }

## ◆ setLogger()

void Gaudi::PluginService::v1::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 325 of file PluginServiceV1.cpp.

325 { s_logger.reset( logger ); }
Gaudi::PluginService::v1::Details::logger
GAUDIPS_API Logger & logger()
Return the current logger instance.
Definition: PluginServiceV1.cpp:324