connect.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_SIGSLOTS_LITE_CONNECT_HPP_
13 #define ECL_SIGSLOTS_LITE_CONNECT_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include "slot.hpp"
20 #include "signal.hpp"
21 #include "errors.hpp"
22 
23 /*****************************************************************************
24 ** Namespaces
25 *****************************************************************************/
26 
27 namespace ecl {
28 namespace lite {
29 
30 /*****************************************************************************
31 ** Privately Used Connects
32 *****************************************************************************/
33 
34 namespace sigslots {
46 template <typename Data, unsigned int Capacity, typename FunctionClass>
48  return signal.connect(slot);
49 }
50 
62 template <typename Data, unsigned int Capacity>
64  return signal.connect(slot);
65 }
66 
67 } // namespace sigslots
68 
69 /*****************************************************************************
70 ** Publicly Used Connects
71 *****************************************************************************/
72 
88 template <typename Data, unsigned int Capacity, typename FunctionClass>
89 sigslots::Error connect(Signal<Data,Capacity> &signal, void(FunctionClass::*f)(Data), FunctionClass &o) {
90  // Need to do this just in case o has member slot interfaces for multiple Data types.
91  // If we don't it can't resolve the footprint that seems to get lost when passing
92  // the function pointers down the line - another way to resolve maybe?
94  sigslots::MemberSlot<Data,FunctionClass> *slot = member_slots.addSlot(f,o);
95  if ( slot != NULL ) {
96  return sigslots::connect(signal,*slot); // koenig lookup also works
97  } else {
99  }
100 }
115 template <typename Data, unsigned int Capacity>
116 sigslots::Error connect(Signal<Data, Capacity> &signal, void (*function)(Data)) {
118  if ( slot != NULL ) {
119  return sigslots::connect(signal,*slot);
120  } else {
122  }
123 
124 }
125 
126 /*****************************************************************************
127 ** Publicly Used Connect Overloads
128 *****************************************************************************/
129 
140 template <unsigned int Capacity, typename FunctionClass>
141 sigslots::Error connect(Signal<void, Capacity> &signal, void(FunctionClass::*function)(void), FunctionClass &o) {
142  // Need to do this just in case o has member slot interfaces for multiple Data types.
143  // If we don't it can't resolve the footprint that seems to get lost when passing
144  // the function pointers down the line - another way to resolve maybe?
146  sigslots::MemberSlot<void,FunctionClass> *slot = member_slots.addSlot(function,o);
147  if ( slot != NULL ) {
148  return sigslots::connect(signal,*slot); // koenig lookup also works
149  } else {
151  }
152 }
162 template <unsigned int Capacity>
163 sigslots::Error connect(Signal<void, Capacity> &signal, void (*function)(void)) {
165  if ( slot != NULL ) {
166  return sigslots::connect(signal,*slot);
167  } else {
169  }
170 
171 }
172 
173 } // namespace lite
174 } // namespace ecl
175 
176 #endif /* ECL_SIGSLOTS_LITE_CONNECT_HPP_ */
Error handling types and classes for lite sigslots.
A simple signal class.
Definition: managers.hpp:32
A slot with global/static callback function.
Definition: slot.hpp:132
sigslots::Error connect(sigslots::SlotBase< Data > &slot)
Connect the signal to the specified slot.
Definition: signal.hpp:88
Used internally to retrieve info about members lots.
Definition: managers.hpp:43
A slot with member callback function.
Definition: slot.hpp:52
Used internally to retrieve info about void member slots.
Definition: managers.hpp:54
Specialisation of the signal for data-less sigslots.
Definition: signal.hpp:148
ecl::lite::sigslots::Error connect(ecl::lite::Signal< Data, Capacity > &signal, MemberSlot< Data, FunctionClass > &slot)
Internal worker used to connect a signal with a slot.
Definition: connect.hpp:47
A slot with member callback function.
Definition: slot.hpp:110
static sigslots::GlobalSlot< Data > * addSlot(void(*func)(Data))
Add a slot.
Definition: managers.hpp:231
virtual sigslots::MemberSlot< Data, FunctionClass > * addSlot(void(FunctionClass::*func)(Data), FunctionClass &instance)=0
Extends the generic ecl error handler with some time specific error strings.
Definition: errors.hpp:41
Simple signal interface.
virtual sigslots::MemberSlot< void, FunctionClass > * addSlot(void(FunctionClass::*func)(), FunctionClass &instance)=0
A slot with global/static callback function.
Definition: slot.hpp:75
Simple slots - these are actually all hidden from the user.


ecl_sigslots_lite
Author(s): Daniel Stonier
autogenerated on Fri Jun 7 2019 21:52:46