14 #ifndef ECL_SIGSLOTS_SLOT_HPP_ 15 #define ECL_SIGSLOTS_SLOT_HPP_ 22 #include <ecl/config/macros.hpp> 23 #include <ecl/utilities/void.hpp> 47 template <
typename Data=Vo
id>
58 Slot(
void (*f)(Data)) : sigslot(NULL) {
59 sigslot =
new SigSlot<Data>(
f);
72 Slot(
void (*f)(Data),
const std::string &topic) : sigslot(NULL) {
73 sigslot =
new SigSlot<Data>(
f);
87 Slot(
void (C::*f)(Data), C &c) : sigslot(NULL) {
88 sigslot =
new SigSlot<Data>(f,c);
102 template <
typename C>
103 Slot(
void (C::*f)(Data), C &c,
const std::string& topic) : sigslot(NULL) {
104 sigslot =
new SigSlot<Data>(f,c);
119 Slot(
const Slot& slot) {
121 sigslot->incrHandles();
132 sigslot->decrHandles();
133 if ( sigslot->handles() == 0 ) {
143 const std::set<std::string>& connections() {
return sigslot->subscribedTopics(); }
152 void connect(
const std::string& topic) { sigslot->connectSlot(topic); }
158 void disconnect() { sigslot->disconnect(); }
161 SigSlot<Data>* sigslot;
188 sigslot =
new SigSlot<Void>(f);
199 Slot(
VoidFunction f,
const std::string &topic) : sigslot(NULL) {
200 sigslot =
new SigSlot<Void>(f);
212 template <
typename C>
213 Slot(
void (C::*f)(
void), C &c) : sigslot(NULL) {
214 sigslot =
new SigSlot<Void>(f,c);
226 template <
typename C>
227 Slot(
void (C::*f)(
void), C &c,
const std::string &topic) : sigslot(NULL) {
228 sigslot =
new SigSlot<Void>(f,c);
242 Slot(
const Slot& slot) {
244 sigslot->incrHandles();
254 sigslot->decrHandles();
255 if ( sigslot->handles() == 0 ) {
267 void connect(
const std::string& topic) { sigslot->connectSlot(topic); }
273 void disconnect() { sigslot->disconnect(); }
276 SigSlot<Void>* sigslot;