2013-08-06 13:33:59 +04:00
|
|
|
// Taken from https://developer.gnome.org/libsigc++-tutorial/stable/ch02.html
|
|
|
|
|
|
|
|
#include <iostream>
|
2016-04-29 17:53:13 +03:00
|
|
|
#include <sigc++/sigc++.h>
|
2013-08-06 13:33:59 +04:00
|
|
|
|
|
|
|
class AlienDetector
|
|
|
|
{
|
|
|
|
public:
|
2016-05-16 17:34:04 +03:00
|
|
|
AlienDetector() {}
|
2013-08-06 13:33:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void run() {}
|
2013-08-06 13:33:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
sigc::signal<void> signal_detected;
|
2013-08-06 13:33:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
void warn_people()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
std::cout << "There are aliens in the carpark!" << std::endl;
|
2013-08-06 13:33:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
AlienDetector mydetector;
|
|
|
|
mydetector.signal_detected.connect(sigc::ptr_fun(warn_people));
|
2013-08-06 13:33:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
mydetector.run();
|
2013-08-06 13:33:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
return 0;
|
2013-08-06 13:33:59 +04:00
|
|
|
}
|