22 #ifndef LUNCHBOX_PLUGIN_H
23 #define LUNCHBOX_PLUGIN_H
25 #include <servus/uint128_t.h>
26 #include <boost/function.hpp>
27 #include <boost/function_equal.hpp>
47 template<
class PluginT,
class InitDataT = servus::URI >
class Plugin
54 typedef boost::function< PluginT* ( const InitDataT& ) >
Constructor;
60 typedef boost::function< bool ( const 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 Constructor constructor;
86 servus::uint128_t tag;
boost::function< bool(const InitDataT &) > HandlesFunc
The method to check if the plugin can handle a given initData.
Factory for Plugin classes.
boost::function< PluginT *(const 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 PluginT interface.
bool operator!=(const Plugin &rhs) const
bool operator==(const Plugin &rhs) const
Plugin(const Constructor &constructor_, const HandlesFunc &handles_)
Construct a new Plugin.