Lunchbox  1.14.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
lunchbox::Plugin< T > Class Template Reference

Manages a class deriving from a T interface. More...

#include <plugin.h>

+ Collaboration diagram for lunchbox::Plugin< T >:

Public Types

typedef std::function< T *(const typename T::InitDataT &)> Constructor
 The constructor method / concrete factory for Plugin objects. More...
 
typedef std::function< bool(const typename T::InitDataT &)> HandlesFunc
 The method to check if the plugin can handle a given initData. More...
 

Public Member Functions

 Plugin (const Constructor &constructor, const HandlesFunc &handles_)
 Construct a new Plugin. More...
 
bool operator== (const Plugin &rhs) const
 
bool operator!= (const Plugin &rhs) const
 
T * construct (const typename T::InitDataT &data)
 Construct a new plugin instance. More...
 
bool handles (const typename T::InitDataT &data)
 

Detailed Description

template<class T>
class lunchbox::Plugin< T >

Manages a class deriving from a T interface.

Plugin classes deriving from T must implement the following prototype for their constructor:

DerivedPluginClass( const T::InitDataT& initData );

T must also implement the following method to be registered:

static bool handles( const T::InitDataT& initData );

Note this requires a 'typedef [foo] InitDataT' in T.

Version
1.11.0

Definition at line 47 of file plugin.h.

Member Typedef Documentation

template<class T>
typedef std::function< T* ( const typename T::InitDataT& )> lunchbox::Plugin< T >::Constructor

The constructor method / concrete factory for Plugin objects.

Version
1.11.0

Definition at line 54 of file plugin.h.

template<class T>
typedef std::function< bool ( const typename T::InitDataT& )> lunchbox::Plugin< T >::HandlesFunc

The method to check if the plugin can handle a given initData.

Version
1.11.0

Definition at line 60 of file plugin.h.

Constructor & Destructor Documentation

template<class T>
lunchbox::Plugin< T >::Plugin ( const Constructor constructor,
const HandlesFunc handles_ 
)
inline

Construct a new Plugin.

Parameters
constructor_The constructor method for Plugin objects.
handles_The method to check if the plugin can handle the initData.
Version
1.11.0

Definition at line 69 of file plugin.h.

Member Function Documentation

template<class T>
T* lunchbox::Plugin< T >::construct ( const typename T::InitDataT &  data)
inline

Construct a new plugin instance.

Version
1.14

Definition at line 81 of file plugin.h.

template<class T>
bool lunchbox::Plugin< T >::handles ( const typename T::InitDataT &  data)
inline
Returns
true if this plugin handles the given request.
Version
1.14

Definition at line 85 of file plugin.h.

template<class T>
bool lunchbox::Plugin< T >::operator!= ( const Plugin< T > &  rhs) const
inline
Returns
false if the plugins do wrap the same plugin.
Version
1.11.0

Definition at line 78 of file plugin.h.

template<class T>
bool lunchbox::Plugin< T >::operator== ( const Plugin< T > &  rhs) const
inline
Returns
true if the plugins wrap the same plugin.
Version
1.11.0

Definition at line 74 of file plugin.h.


The documentation for this class was generated from the following file: