22 #ifndef LUNCHBOX_PLUGIN_H 23 #define LUNCHBOX_PLUGIN_H 25 #include <servus/uint128_t.h> 54 typedef std::function< T* ( const typename T::InitDataT& )>
Constructor;
60 typedef std::function< bool ( const typename T::InitDataT& )>
HandlesFunc;
69 Plugin(
const Constructor& constructor,
const HandlesFunc& handles_ )
70 : _constructor( constructor ), _handles( handles_ )
71 , tag( servus::make_UUID( )) {}
75 {
return tag == rhs.tag; }
82 {
return _constructor( data ); }
85 bool handles(
const typename T::InitDataT& data )
86 {
return _handles( data ); }
89 Constructor _constructor;
93 servus::uint128_t tag;
bool handles(const typename T::InitDataT &data)
std::function< T *(const typename T::InitDataT &)> Constructor
The constructor method / concrete factory for Plugin objects.
Abstraction layer and common utilities for multi-threaded programming.
Manages a class deriving from a T interface.
Plugin(const Constructor &constructor, const HandlesFunc &handles_)
Construct a new Plugin.
bool operator==(const Plugin &rhs) const
bool operator!=(const Plugin &rhs) const
std::function< bool(const typename T::InitDataT &)> HandlesFunc
The method to check if the plugin can handle a given initData.
T * construct(const typename T::InitDataT &data)
Construct a new plugin instance.