25template<
typename TPlugin,
typename TPriorities>
67template<
typename TPlugin,
typename TPriorities>
126 ALIB_ASSERT_ERROR( plugin !=
nullptr,
"FSPLUGINS",
"Nullptr provided for plugin." )
129 std::has_virtual_destructor<TPlugin>::value
131 "Can't take responsibility for plug-in destruction. TPlugin has no virtual destructor.")
137 [plugin,
this](
Slot& ppp)
139 ALIB_ASSERT_ERROR( ppp.plugin->GetPriority() != plugin->GetPriority(),
"FSPLUGINS",
140 "PluginContainer::InsertPlugin(): Plug-in with same priority {} exists",
141 ppp.plugin->GetPriority() )
143 return ppp.plugin->GetPriority() < plugin->GetPriority();
145 Slot { plugin, responsibility == lang::Responsibility::Transfer } );
162 return pair.plugin == plugIn;
169 ALIB_WARNING(
"LANG",
"PluginContainer::RemovePlugin(): Plug-in not found for removal.")
182 "PluginContainer::RemovePlugin(): Index out of bounds: {} >= {}", idx,
CountPlugins() )
197 TPlugin* plugin=
nullptr;
199 [priority, &plugin](
Slot& entry)
201 if( entry.priority == priority) {
202 plugin= entry.plugin;
247 [priority](
Slot& pair) { return pair.priority == priority; } );
262 template<
typename TPluginType>
264 {
return dynamic_cast<TPluginType*
>(
GetPlugin( priority ) ); }
270 template<
typename TPluginType>
272 TPluginType* cast=
nullptr;
274 if( (cast=
dynamic_cast<TPluginType*
>( ppp.plugin )) !=
nullptr )
#define ALIB_WARNING(domain,...)
#define ALIB_STATIC_ASSERT(CondVariable, Cond, Message)
#define ALIB_ASSERT_WARNING(cond, domain,...)
#define ALIB_POP_ALLOWANCE
#define ALIB_ALLOW_UNUSED_LAMBDA_CAPTURE
#define ALIB_ASSERT_ERROR(cond, domain,...)
TPlugin * GetPlugin(TPriorities priority)
TPlugin * RemovePlugin(TPriorities priority)
TPlugin PluginType
This exposes the template parameter pTPlugin to the outer world.
void RemovePlugin(integer idx)
std::vector< Slot > PluginList
The list that stores the plugins.
TPriorities GetPriority(integer number)
bool RemovePlugin(TPlugin *plugIn)
TPlugin * GetPlugin(integer number)
TPriorities PrioritiesType
This exposes the template parameter pTPlugin to the outer world.
PluginList plugins
The plug-ins we have attached in descending priority order.
void InsertPlugin(TPlugin *plugin, lang::Responsibility responsibility=lang::Responsibility::KeepWithSender)
TPluginType * GetPluginTypeSafe(TPriorities priority)
TPluginType * GetPluginTypeSafe()
TPriorities PrioritiesType
This exposes the template parameter pTPlugin to the outer world.
TPlugin PluginType
This exposes the template parameter TPlugin to the outer world.
PrioritiesType priority
The priority of this plug-in.
PrioritiesType GetPriority() const
Plugin(PrioritiesType pPriority)
platform_specific integer
@ KeepWithSender
Keeps responsibility, e.g., when passing an object.
Type definition for elements of the list of plug-ins with their priority.
TPlugin * plugin
The plug-in.