11 #ifndef MIDGE_SIGNAL_HH_ 12 #define MIDGE_SIGNAL_HH_ 18 #include "member_variables.hh" 31 template<
typename x_owner >
46 template<
typename... x_args >
54 template<
typename x_owner >
63 template<
typename T >
64 unsigned connect_function( T *inst,
void (T::*func)( x_args... ) );
67 template<
typename T >
68 unsigned connect_function( T *inst,
void (T::*func)( x_args... )
const );
72 unsigned connect_function(
const std::function< signature > &
slot )
const;
75 void disconnect(
unsigned id )
const;
78 void disconnect_all()
const;
81 void emit( x_args... args );
82 void operator()( x_args... args );
88 typedef std::map< unsigned, std::function< signature > >
slot_map;
89 mv_referrable_mutable_const( slot_map, slots );
90 mv_accessible_mutable_noset(
unsigned, current_id );
94 template<
typename x_owner >
98 if( p_owner ) p_owner->signal_ptr(
this, p_name );
102 template<
typename... x_args >
109 template<
typename... x_args >
110 template<
typename x_owner >
117 template<
typename... x_args >
124 template<
typename... x_args >
125 template<
typename T >
128 return connect( [=]( x_args... args )
130 (inst->*func)( args... );
135 template<
typename... x_args >
136 template<
typename T >
139 return connect( [=]( x_args... args )
141 (inst->*func)( args... );
147 template<
typename... x_args >
150 f_slots.insert( std::make_pair( ++f_current_id, slot ) );
155 template<
typename... x_args >
162 template<
typename... x_args >
169 template<
typename... x_args >
172 for(
auto it : f_slots )
174 it.second( args... );
178 template<
typename... x_args >
void disconnect_all() const
void disconnect(unsigned id) const
unsigned connect_function(T *inst, void(T::*func)(x_args...))
void(x_args...) signature
virtual unsigned connect(slot *p_slot)
virtual unsigned connect(slot *p_slot)=0
signal(const string_t &p_name)
m_signal(const string_t &p_name)
void operator()(x_args... args)
void emit(x_args... args)
std::map< unsigned, std::function< signature > > slot_map