Go to the documentation of this file.00001
00008
00009
00010
00011
00012 #ifndef ECL_SIGSLOTS_LITE_CONNECT_HPP_
00013 #define ECL_SIGSLOTS_LITE_CONNECT_HPP_
00014
00015
00016
00017
00018
00019 #include "slot.hpp"
00020 #include "signal.hpp"
00021 #include "errors.hpp"
00022
00023
00024
00025
00026
00027 namespace ecl {
00028 namespace lite {
00029
00030
00031
00032
00033
00034 namespace sigslots {
00046 template <typename Data, unsigned int Capacity, typename FunctionClass>
00047 ecl::lite::sigslots::Error connect(ecl::lite::Signal<Data, Capacity> &signal, MemberSlot<Data,FunctionClass> &slot) {
00048 return signal.connect(slot);
00049 }
00050
00062 template <typename Data, unsigned int Capacity>
00063 ecl::lite::sigslots::Error connect(ecl::lite::Signal<Data, Capacity> &signal, GlobalSlot<Data> &slot) {
00064 return signal.connect(slot);
00065 }
00066
00067 }
00068
00069
00070
00071
00072
00088 template <typename Data, unsigned int Capacity, typename FunctionClass>
00089 sigslots::Error connect(Signal<Data,Capacity> &signal, void(FunctionClass::*f)(Data), FunctionClass &o) {
00090
00091
00092
00093 sigslots::MemberSlotsBase<Data,FunctionClass> &member_slots = o;
00094 sigslots::MemberSlot<Data,FunctionClass> *slot = member_slots.addSlot(f,o);
00095 if ( slot != NULL ) {
00096 return sigslots::connect(signal,*slot);
00097 } else {
00098 return sigslots::Error(sigslots::OutOfResourcesError);
00099 }
00100 }
00115 template <typename Data, unsigned int Capacity>
00116 sigslots::Error connect(Signal<Data, Capacity> &signal, void (*function)(Data)) {
00117 sigslots::GlobalSlot<Data> *slot = GlobalSlots<Data>::addSlot(function);
00118 if ( slot != NULL ) {
00119 return sigslots::connect(signal,*slot);
00120 } else {
00121 return sigslots::Error(sigslots::OutOfResourcesError);
00122 }
00123
00124 }
00125
00126
00127
00128
00129
00140 template <unsigned int Capacity, typename FunctionClass>
00141 sigslots::Error connect(Signal<void, Capacity> &signal, void(FunctionClass::*function)(void), FunctionClass &o) {
00142
00143
00144
00145 sigslots::MemberSlotsBase<void,FunctionClass> &member_slots = o;
00146 sigslots::MemberSlot<void,FunctionClass> *slot = member_slots.addSlot(function,o);
00147 if ( slot != NULL ) {
00148 return sigslots::connect(signal,*slot);
00149 } else {
00150 return sigslots::Error(sigslots::OutOfResourcesError);
00151 }
00152 }
00162 template <unsigned int Capacity>
00163 sigslots::Error connect(Signal<void, Capacity> &signal, void (*function)(void)) {
00164 sigslots::GlobalSlot<void> *slot = GlobalSlots<void>::addSlot(function);
00165 if ( slot != NULL ) {
00166 return sigslots::connect(signal,*slot);
00167 } else {
00168 return sigslots::Error(sigslots::OutOfResourcesError);
00169 }
00170
00171 }
00172
00173 }
00174 }
00175
00176 #endif