jle_cpp_tk  0.0 2015-04-03 sh1:"d699093732dd5f321606d0ff7a6b63b229f1922c"
A small, safe, selft contained, soft-realtime C++ toolkit
jle::signal< Args > Class Template Reference

signal instance to connect and emit More...

#include <signal_slot.hpp>

Inheritance diagram for jle::signal< Args >:
Collaboration diagram for jle::signal< Args >:

Public Member Functions

 signal (const signal &)=delete
 
 signal (signal &&)=default
 
signaloperator= (const signal &)=delete
 
signaloperator= (signal &&)=default
 
int get_processing_emits (void) const
 it will give the number of emits on scope More...
 
template<typename TReceiver >
void connect (TReceiver *receiver, void(TReceiver::*fpt)(Args...))
 
template<typename TReceiver >
bool disconnect (TReceiver *receiver, void(TReceiver::*fpt)(Args...))
 disconnect a signal from a method More...
 
void disconnect_all (void)
 disconnect all signals More...
 
int notify (Args...args)
 same as emit More...
 
int emit (Args...args)
 call all connected to the signal More...
 
void operator() (Args...args)
 same as emit More...
 
template<typename TReceiver >
void connect (TReceiver *receiver)
 
void connect (void(*pt2Function)(Args...))
 connect a signal to a function
 
bool disconnect (void(*pt2Function)(Args...))
 disonnect a signal from a function
 
- Public Member Functions inherited from jle::signal_receptor
 signal_receptor (const signal_receptor &)=delete
 
 signal_receptor (signal_receptor &&)=default
 
signal_receptoroperator= (const signal_receptor &)=delete
 
signal_receptoroperator= (signal_receptor &&)=default
 

Detailed Description

template<typename... Args>
class jle::signal< Args >

signal instance to connect and emit

You can connect to functions methods and even other signals It is static, good performance and compiling time checked

Example:

Examples:
/core/ex_signal_slot.cpp.

Member Function Documentation

template<typename... Args>
int jle::signal< Args >::get_processing_emits ( void  ) const
inline

it will give the number of emits on scope

Used internally to check if running on destructor

template<typename... Args>
template<typename TReceiver >
bool jle::signal< Args >::disconnect ( TReceiver *  receiver,
void(TReceiver::*)(Args...)  fpt 
)
inline

disconnect a signal from a method

If you have connected a signal more than one to a method (allowed), disconnect will remove only one of the connections

template<typename... Args>
void jle::signal< Args >::disconnect_all ( void  )
inline

disconnect all signals

It will disconnect from functions, methods and other signals

template<typename... Args>
int jle::signal< Args >::notify ( Args...  args)
inline

same as emit

emit is defined as a macro on Qt toolkit. Using notify avoid conflicts with Qt

template<typename... Args>
int jle::signal< Args >::emit ( Args...  args)
inline

call all connected to the signal

Exceptions are not trapped. If an exception is thrown some slots couldn't receive the signal

Catching the error here to guaranty all slots are called has no cpu cost. But the context information, would be limited

template<typename... Args>
void jle::signal< Args >::operator() ( Args...  args)
inline

same as emit

I don't like this option, but it is quite frecuent


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