14 #include "../../include/ecl/sigslots.hpp" 33 std::cout <<
" ---> Hey Dude" << std::endl;
37 std::cout <<
" ---> Hey Chained Dude" << std::endl;
40 void h(
const int& i) {
41 std::cout <<
" ---> Hey Data Dude: " << i << std::endl;
50 A() : slot(&A::
f,*this), slot_data(&A::
g,*this) {
51 slot.connect(
"Dudette");
52 slot_data.connect(
"DataDudette");
56 std::cout <<
" ---> Hey Dudette" << std::endl;
58 void g(
const int& i) {
59 std::cout <<
" ---> Hey Data Dudette: " << i << std::endl;
72 int main(
int argc,
char **argv) {
74 std::cout <<
"Hello dude" << std::endl;
76 std::cout << std::endl;
77 std::cout <<
"***************************************************************" << std::endl;
78 std::cout <<
"* Global Function" << std::endl;
79 std::cout <<
"***************************************************************" << std::endl;
80 std::cout << std::endl;
83 std::cout <<
"Connecting 1 signal and two slots to 'Dude'" << std::endl;
88 std::cout <<
"Emitting" << std::endl;
90 std::cout << std::endl;
92 std::cout << std::endl;
94 std::cout <<
"Connecting a data slot-signal pair to 'DataDude'" << std::endl;
97 slot_data_1.
connect(
"DataDude");
99 std::cout <<
"Emitting" << std::endl;
101 std::cout << std::endl;
104 std::cout << std::endl;
105 std::cout <<
"***************************************************************" << std::endl;
106 std::cout <<
"* Disconnects" << std::endl;
107 std::cout <<
"***************************************************************" << std::endl;
108 std::cout << std::endl;
110 std::cout <<
"Disconnecting second slot" << std::endl;
112 std::cout <<
"Emitting" << std::endl;
114 std::cout <<
"Disconnecting signal" << std::endl;
116 std::cout <<
"Emitting (to nowhere)" << std::endl;
118 std::cout << std::endl;
121 std::cout << std::endl;
122 std::cout <<
"***************************************************************" << std::endl;
123 std::cout <<
"* Relays" << std::endl;
124 std::cout <<
"***************************************************************" << std::endl;
125 std::cout << std::endl;
127 std::cout <<
"Connecting signal and second slot back to 'Dude'" << std::endl;
130 std::cout << std::endl;
132 std::cout << std::endl;
135 std::cout <<
"Connecting relay as signal to 'ChainedDude'" << std::endl;
136 signal_relay.
connect(
"ChainedDude");
137 std::cout <<
"Connecting relay as slot to 'Dude'." << std::endl;
140 std::cout <<
"Connecting slot to 'ChainedDude'" << std::endl;
142 std::cout <<
"Emitting" << std::endl;
144 std::cout << std::endl;
147 std::cout << std::endl;
148 std::cout <<
"***************************************************************" << std::endl;
149 std::cout <<
"* Member Functions" << std::endl;
150 std::cout <<
"***************************************************************" << std::endl;
151 std::cout << std::endl;
153 std::cout <<
"Creating a member slot and connecting to 'Dudette'" << std::endl;
155 std::cout <<
"Connecting a signal to 'Dudette'" << std::endl;
157 signal_dudette.
connect(
"Dudette");
158 signal_dudette.
emit();
160 std::cout << std::endl;
162 std::cout <<
"Creating a member data slot and connecting to 'DataDudette'" << std::endl;
163 std::cout <<
"Connecting a data signal to 'DataDudette'" << std::endl;
165 signal_data_dudette.
connect(
"DataDudette");
166 signal_data_dudette.
emit(3);
167 std::cout << std::endl;
void connectAsSlot(const std::string &topic)
Connect as a slot, with the emit function loaded.
The sigslots connection manager.
int main(int argc, char **argv)
void connect(const std::string &topic)
Make a connection to the specified topic.
void disconnect()
Disconnect the slot from all topics.
void disconnect()
Disconnect the signal from all topics.
void f(int i) ecl_debug_throw_decl(StandardException)
Signalling component of a callback system.
void connect(const std::string &topic)
Make a connection to the specified topic.
void emit(Data data)
The primary purpose of the signal, to emit!
Function loading component of a callback system.