| The Gaudi Framework v30r0 (c919700c)

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

- Namespace List
- Namespace Members

Classes | Functions
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 >
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

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

146 { return demangle( id.name() ); }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
Gaudi::PluginService::Details::demangle
std::string demangle(const std::string &id)
Definition: PluginService.cpp:131
template<typename T >

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

Return a canonical name for the template argument.

Definition at line 104 of file PluginServiceDetails.h.

105 {
106 return demangle( typeid( T ) );
107 }
Gaudi::PluginService::Details::demangle
std::string demangle()
Return a canonical name for the template argument.
Definition: PluginServiceDetails.h:104

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

Definition at line 131 of file PluginService.cpp.

132 {
133 int status;
134 auto realname = std::unique_ptr<char, decltype( free )*>(
135 abi::__cxa_demangle( id.c_str(), nullptr, nullptr, &status ), free );
136 if ( !realname ) return id;
137 #if _GLIBCXX_USE_CXX11_ABI
138 return std::regex_replace(
139 realname.get(),
140 std::regex{"std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >( (?=>))?"},
141 "std::string" );
142 #else
143 return std::string{realname.get()};
144 #endif
145 }
std::free
T free(T...args)
std::string
STL class.
std::regex_replace
T regex_replace(T...args)
std::unique_ptr
STL class.
std::regex

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

127 {
128 return Registry::instance().get( id, type );
129 }
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:

- 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 87 of file PluginServiceDetails.h.

88 {
89 union {
90 void* src;
91 F dst;
92 } p2p;
93 p2p.src = getCreator( id, typeid( F ).name() );
94 return p2p.dst;
95 }
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
Gaudi::PluginService::Details::getCreator
F getCreator(const std::string &id)
Convoluted implementation of getCreator with an embedded reinterpret_cast, used to avoid the warning...
Definition: PluginServiceDetails.h:87
ReadAndWriteWhiteBoard.dst
dst
Definition: ReadAndWriteWhiteBoard.py:17

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

Return the current logger instance.

Definition at line 339 of file PluginService.cpp.

339 { return *s_logger; }

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

340 { s_logger.reset( logger ); }
Gaudi::PluginService::Details::logger
GAUDIPS_API Logger & logger()
Return the current logger instance.
Definition: PluginService.cpp:339