MEL
Microthread & Execution library
mel::core::CallbackSubscriptor_Base< ThreadingPolicy, VARIABLE_ARGS > Class Template Reference

callback subscription functionalit More...

#include <CallbackSubscriptor_Impl.h>

Classes

struct  CallbackInfo
 
struct  PendingOperation
 

Public Types

typedef Callback< ECallbackResult, VARIABLE_ARGS_DECL > CallbackType
 
typedef list< CallbackInfoCallbackListType
 

Public Member Functions

size_t getNumCallbacks () const
 
void removeCallbacks ()
 
template<class U >
int subscribeCallback (U &&callback, SubscriptionEmplacement se=SE_BACK)
 
int subscribeCallback (std::function< ECallbackResult(VARIABLE_ARGS_DECL)> &&callback, SubscriptionEmplacement se=SE_BACK)
 
int subscribeCallback (const std::function< ECallbackResult(VARIABLE_ARGS_DECL)> &callback, SubscriptionEmplacement se=SE_BACK)
 
int subscribeCallback (std::function< ECallbackResult(VARIABLE_ARGS_DECL)> &callback, SubscriptionEmplacement se=SE_BACK)
 
bool unsubscribeCallback (std::function< ECallbackResult(VARIABLE_ARGS_DECL)> &&callback)=delete
 
template<class U >
bool unsubscribeCallback (U &&callback)
 
bool unsubscribeCallback (int id)
 
int subscribeCreatedCallback (CallbackType *cb, SubscriptionEmplacement se=SE_BACK)
 
bool unsubscribeCreatedCallback (std::shared_ptr< CallbackType > cb)
 
void append (const CallbackSubscriptor_Base< ThreadingPolicy, VARIABLE_ARGS_DECL > &ob2)
 
void append (CallbackSubscriptor_Base< ThreadingPolicy, VARIABLE_ARGS_DECL > &&ob2)
 
CallbackListType & getCallbacks ()
 
const CallbackListType & getCallbacks () const
 

Protected Member Functions

 CallbackSubscriptor_Base (const CallbackSubscriptor_Base &o2)
 
void _applyPendingOperations ()
 

Protected Attributes

bool mTriggering
 
std::deque< PendingOperationmPendingOperation
 
CallbackListType mCallbacks
 
_private::_CriticalSectionWrapper< mpl::isSame< ThreadingPolicy, mel::core::CSMultithreadPolicy >::result > mSC
 

Static Protected Attributes

static int mCurrId = 0
 

Detailed Description

template<class ThreadingPolicy, VARIABLE_ARGS>
class mel::core::CallbackSubscriptor_Base< ThreadingPolicy, VARIABLE_ARGS >

callback subscription functionalit

Member Function Documentation

◆ subscribeCreatedCallback()

template<class ThreadingPolicy , VARIABLE_ARGS >
int mel::core::CallbackSubscriptor_Base< ThreadingPolicy, VARIABLE_ARGS >::subscribeCreatedCallback ( CallbackType cb,
SubscriptionEmplacement  se = SE_BACK 
)
inline

special case for subscription with Callback already created. Takes ownership

◆ unsubscribeCallback()

template<class ThreadingPolicy , VARIABLE_ARGS >
bool mel::core::CallbackSubscriptor_Base< ThreadingPolicy, VARIABLE_ARGS >::unsubscribeCallback ( std::function< ECallbackResult(VARIABLE_ARGS_DECL)> &&  callback)
delete

std::function lacks operator ==, so need to use unsubscribecallback(int id) or use any other mpl function capabilities

◆ unsubscribeCreatedCallback()

template<class ThreadingPolicy , VARIABLE_ARGS >
bool mel::core::CallbackSubscriptor_Base< ThreadingPolicy, VARIABLE_ARGS >::unsubscribeCreatedCallback ( std::shared_ptr< CallbackType cb)
inline

Unsubscribe an already existing callback It looks for a callback equal to passed (cb), NOT THE POINTER

Parameters
[in]cbthe callback being desuscribed,
Returns
true if unsubscribed (false otherwise)

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