11 #ifndef _GAUDI_PLUGIN_SERVICE_DETAILS_V2_H_
12 #define _GAUDI_PLUGIN_SERVICE_DETAILS_V2_H_
30 namespace PluginService {
42 template <
typename R,
typename... Args>
43 struct Traits<R( Args... )> {
60 template <
typename ID>
112 inline bool is_set()
const {
return factory.has_value(); }
113 Properties::mapped_type getprop(
const Properties::key_type&
name )
const;
120 template <
typename F>
121 F
get(
const KeyType&
id ) {
122 const FactoryInfo& info = Registry::instance().getInfo(
id,
true );
123 #ifdef GAUDI_REFLEX_COMPONENT_ALIASES
124 if ( !info.getprop(
"ReflexName" ).empty() ) {
125 const std::string real_name = info.getprop(
"ClassName" );
126 logger().warning(
"requesting factory via old name '" +
id +
"' use '" +
127 ( real_name.
empty() ?
"<undefined>" : real_name ) +
"' instead" );
130 return std::any_cast<F>( info.factory );
134 static Registry& instance();
137 FactoryInfo&
add(
const KeyType&
id, FactoryInfo info );
140 FactoryMap::size_type erase(
const KeyType&
id );
143 const FactoryInfo& getInfo(
const KeyType&
id,
const bool load =
false )
const;
146 Registry& addProperty(
const KeyType&
id,
const KeyType& k,
const std::string&
v );
163 Registry(
const Registry& ) =
delete;
176 FactoryMap m_factories;
186 template <
typename,
typename>
187 struct DefaultFactory;
188 template <
typename T,
typename R,
typename... Args>
189 struct DefaultFactory<T, Factory<R( Args... )>> {
190 inline typename Factory<R( Args... )>::ReturnType operator()( Args...
args ) {
209 #define _PS_V2_INTERNAL_FACTORY_MAKE_REGISTER_CNAME_TOKEN( serial ) _register_##serial
210 #define _PS_V2_INTERNAL_FACTORY_MAKE_REGISTER_CNAME( serial ) \
211 _PS_V2_INTERNAL_FACTORY_MAKE_REGISTER_CNAME_TOKEN( serial )
212 #define _PS_V2_INTERNAL_FACTORY_REGISTER_CNAME _PS_V2_INTERNAL_FACTORY_MAKE_REGISTER_CNAME( __LINE__ )
214 #endif //_GAUDI_PLUGIN_SERVICE_DETAILS_H_