Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
appbase::method< FunctionSig, DispatchPolicy > Class Template Referencefinal

#include <method.hpp>

Inheritance diagram for appbase::method< FunctionSig, DispatchPolicy >:
Collaboration diagram for appbase::method< FunctionSig, DispatchPolicy >:

Classes

class  handle
 

Public Member Functions

template<typename T >
handle register_provider (T provider, int priority=0)
 

Protected Member Functions

 method ()=default
 
virtual ~method ()=default
 

Static Protected Member Functions

static void deleter (void *erased_method_ptr)
 
static methodget_method (erased_method_ptr &ptr)
 
static erased_method_ptr make_unique ()
 

Friends

class appbase::application
 

Detailed Description

template<typename FunctionSig, typename DispatchPolicy>
class appbase::method< FunctionSig, DispatchPolicy >

A method is a loosely linked application level function. Callers can grab a method and call it Providers can grab a method and register themselves

This removes the need to tightly couple different plugins in the application.

Template Parameters
FunctionSig- the signature of the method (eg void(int, int))
DispatchPolicy- the policy for dispatching this method

Definition at line 197 of file method.hpp.

Constructor & Destructor Documentation

◆ method()

template<typename FunctionSig , typename DispatchPolicy >
appbase::method< FunctionSig, DispatchPolicy >::method ( )
protecteddefault
Here is the caller graph for this function:

◆ ~method()

template<typename FunctionSig , typename DispatchPolicy >
virtual appbase::method< FunctionSig, DispatchPolicy >::~method ( )
protectedvirtualdefault

Member Function Documentation

◆ deleter()

template<typename FunctionSig , typename DispatchPolicy >
static void appbase::method< FunctionSig, DispatchPolicy >::deleter ( void * erased_method_ptr)
inlinestaticprotected

Proper deleter for type-erased method note: no type checking is performed at this level

Parameters
erased_method_ptr

Definition at line 267 of file method.hpp.

267 {
268 auto ptr = reinterpret_cast<method*>(erased_method_ptr);
269 delete ptr;
270 }
method()=default
std::unique_ptr< void, void(*)(void *)> erased_method_ptr
Definition method.hpp:12
Here is the caller graph for this function:

◆ get_method()

template<typename FunctionSig , typename DispatchPolicy >
static method * appbase::method< FunctionSig, DispatchPolicy >::get_method ( erased_method_ptr & ptr)
inlinestaticprotected

get the method* back from an erased pointer

Parameters
ptr- the type-erased method pointer
Returns
- the type safe method pointer

Definition at line 278 of file method.hpp.

278 {
279 return reinterpret_cast<method*>(ptr.get());
280 }

◆ make_unique()

template<typename FunctionSig , typename DispatchPolicy >
static erased_method_ptr appbase::method< FunctionSig, DispatchPolicy >::make_unique ( )
inlinestaticprotected

Construct a unique_ptr for the type erased method poiner

Returns

Definition at line 286 of file method.hpp.

286 {
287 return erased_method_ptr(new method(), &deleter);
288 }
static void deleter(void *erased_method_ptr)
Definition method.hpp:267
Here is the call graph for this function:

◆ register_provider()

template<typename FunctionSig , typename DispatchPolicy >
template<typename T >
handle appbase::method< FunctionSig, DispatchPolicy >::register_provider ( T provider,
int priority = 0 )
inline

Register a provider of this method

Template Parameters
T- the type of the provider (functor, lambda)
Parameters
provider- the provider
priority- the priority of this provider, lower is called before higher

Definition at line 253 of file method.hpp.

253 {
254 return handle(this->_signal.connect(priority, provider));
255 }

Friends And Related Symbol Documentation

◆ appbase::application

template<typename FunctionSig , typename DispatchPolicy >
friend class appbase::application
friend

Definition at line 290 of file method.hpp.


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