Midge  v3.9.2
Data Processing Framework
Public Types | Public Member Functions | Private Types | Private Member Functions | List of all members
m_signal< x_args > Class Template Reference

#include <signal.hh>

Inheritance diagram for m_signal< x_args >:
Inheritance graph

Public Types

using signature = void(x_args...)
 

Public Member Functions

 m_signal (const string_t &p_name)
 
template<typename x_owner >
 m_signal (const string_t &p_name, x_owner *p_owner)
 
 m_signal (const m_signal &)=delete
 
 m_signal (m_signal &&)=delete
 
virtual ~m_signal ()
 
virtual unsigned connect (slot *p_slot)
 
template<typename T >
unsigned connect_function (T *inst, void(T::*func)(x_args...))
 
template<typename T >
unsigned connect_function (T *inst, void(T::*func)(x_args...) const)
 
unsigned connect_function (const std::function< signature > &slot) const
 
void disconnect (unsigned id) const
 
void disconnect_all () const
 
void emit (x_args... args)
 
void operator() (x_args... args)
 
m_signaloperator= (m_signal const &other)
 
- Public Member Functions inherited from signal
 signal (const string_t &p_name)
 
template<typename x_owner >
 signal (const string_t &p_name, x_owner *p_owner)
 
virtual ~signal ()
 
 snake_case_mv_referrable (string_t, name)
 

Private Types

typedef std::map< unsigned, std::function< signature > > slot_map
 

Private Member Functions

 snake_case_mv_referrable_mutable_const (slot_map, slots)
 
 snake_case_mv_accessible_mutable_noset (unsigned, current_id)
 

Detailed Description

template<typename... x_args>
class midge::m_signal< x_args >

A m_signal object may call multiple slots with the same signature. You can connect functions to the m_signal which will be called when the emit() method on the m_signal object is invoked. Any argument passed to emit() will be passed to the given functions. The name "m_signal" was chosen to avoid conflicting with std::signal.

Definition at line 47 of file signal.hh.

Member Typedef Documentation

◆ signature

using signature = void( x_args... )

Definition at line 50 of file signal.hh.

◆ slot_map

typedef std::map< unsigned, std::function< signature > > slot_map
private

Definition at line 88 of file signal.hh.

Constructor & Destructor Documentation

◆ m_signal() [1/4]

m_signal ( const string_t p_name)

Definition at line 103 of file signal.hh.

◆ m_signal() [2/4]

m_signal ( const string_t p_name,
x_owner *  p_owner 
)

Definition at line 111 of file signal.hh.

◆ m_signal() [3/4]

m_signal ( const m_signal< x_args > &  )
delete

◆ m_signal() [4/4]

m_signal ( m_signal< x_args > &&  )
delete

◆ ~m_signal()

~m_signal ( )
virtual

Definition at line 118 of file signal.hh.

Member Function Documentation

◆ connect()

unsigned connect ( slot p_slot)
virtual

Implements signal.

Definition at line 24 of file signal_slot.hh.

◆ connect_function() [1/3]

unsigned connect_function ( T *  inst,
void(T::*)(x_args...)  func 
)

Definition at line 126 of file signal.hh.

◆ connect_function() [2/3]

unsigned connect_function ( T *  inst,
void(T::*)(x_args...) const  func 
)

◆ connect_function() [3/3]

unsigned connect_function ( const std::function< signature > &  slot) const

Definition at line 148 of file signal.hh.

◆ disconnect()

void disconnect ( unsigned  id) const

Definition at line 156 of file signal.hh.

◆ disconnect_all()

void disconnect_all ( ) const

Definition at line 163 of file signal.hh.

◆ emit()

void emit ( x_args...  args)

Definition at line 170 of file signal.hh.

◆ operator()()

void operator() ( x_args...  args)

Definition at line 179 of file signal.hh.

◆ operator=()

m_signal& operator= ( m_signal< x_args > const &  other)

◆ snake_case_mv_accessible_mutable_noset()

snake_case_mv_accessible_mutable_noset ( unsigned  ,
current_id   
)
private

◆ snake_case_mv_referrable_mutable_const()

snake_case_mv_referrable_mutable_const ( slot_map  ,
slots   
)
private

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