Signals and slots. More...
#include <itpp/protocol/signals_slots.h>
Public Member Functions | |
Signal (const std::string signal_name="Unamed Signal", const bool single_shot=false, const bool enable_debug=false) | |
Default constructor. | |
~Signal () | |
Destructor. | |
void | connect (Base_Slot< DataType > *slot) |
Connect a slot to the signal. | |
void | disconnect (Base_Slot< DataType > *slot=NULL) |
Disconnect the slot from the signal. | |
Base_Event * | operator() (DataType signal, const Ttype delta_time=0) |
Issue a signal. | |
void | cancel () |
cancel signal | |
void | set_name (const std::string &signal_name) |
set name of signal | |
void | set_debug (const bool enable_debug=true) |
Set debug mode. If true all signals are printed to stdout. | |
void | trigger (DataType u) |
ADD DOCUMENTATION HERE. | |
Protected Types | |
typedef std::list< Base_Slot< DataType > *, std::allocator< Base_Slot< DataType > * > >::iterator | Base_Slot_Iterator |
ADD DOCUMENTATION HERE. | |
Protected Member Functions | |
void | _disconnect (Base_Slot< DataType > *slot) |
ADD DOCUMENTATION HERE. | |
Protected Attributes | |
std::list< Base_Slot< DataType > *, std::allocator< Base_Slot< DataType > * > > | connected_slots |
ADD DOCUMENTATION HERE. | |
std::string | name |
ADD DOCUMENTATION HERE. | |
Friends | |
class | Base_Slot< DataType > |
Signals and slots.
A simple example where to objects A and B are communicating through signals and slots. Each object has one signal and one slot. The A_signal is used to send a signal to the B_slot and vice versa. When a signal is received by the B_slot it is forwarded to the function forward(). The class definition includes the definition of the signals, slots and forward functions including a name and the type of data to transmit.
Definition at line 124 of file signals_slots.h.
|
protected |
ADD DOCUMENTATION HERE.
Definition at line 163 of file signals_slots.h.
itpp::Signal< DataType >::Signal | ( | const std::string | signal_name = "Unamed Signal< DataType >" , |
const bool | single_shot = false , |
||
const bool | enable_debug = false |
||
) |
Default constructor.
Definition at line 392 of file signals_slots.h.
itpp::Signal< DataType >::~Signal | ( | ) |
Destructor.
Definition at line 402 of file signals_slots.h.
Connect a slot to the signal.
Definition at line 431 of file signals_slots.h.
Referenced by itpp::TTimer< THandler >::TTimer().
Disconnect the slot from the signal.
Definition at line 454 of file signals_slots.h.
Base_Event * itpp::Signal< DataType >::operator() | ( | DataType | signal, |
const Ttype | delta_time = 0 |
||
) |
Issue a signal.
Definition at line 470 of file signals_slots.h.
References itpp::Event_Queue::add(), and itpp::Array< T >::operator()().
void itpp::Signal< DataType >::cancel | ( | ) |
cancel signal
Definition at line 495 of file signals_slots.h.
Referenced by itpp::TTimer< THandler >::HandleCancelEvent(), itpp::TTimer< THandler >::Reset(), itpp::TTimer< THandler >::Set(), and itpp::TTimer< THandler >::~TTimer().
void itpp::Signal< DataType >::set_name | ( | const std::string & | signal_name | ) |
set name of signal
Definition at line 419 of file signals_slots.h.
Referenced by itpp::TCP_Server_Application::TCP_Server_Application().
Set debug mode. If true all signals are printed to stdout.
Definition at line 425 of file signals_slots.h.
Referenced by itpp::TCP_Server_Application::TCP_Server_Application(), and itpp::TTimer< THandler >::TTimer().
ADD DOCUMENTATION HERE.
Definition at line 506 of file signals_slots.h.
References itpp::Event_Queue::now().
|
protected |
ADD DOCUMENTATION HERE.
Definition at line 523 of file signals_slots.h.
Definition at line 611 of file signals_slots.h.
|
protected |
ADD DOCUMENTATION HERE.
Definition at line 167 of file signals_slots.h.
|
protected |
ADD DOCUMENTATION HERE.
Definition at line 169 of file signals_slots.h.
Generated on Tue Mar 26 2024 19:08:31 for IT++ by Doxygen 1.9.8