Was quite easy actually. :-)
#include <iostream>
#include
#include
namespace jc
{
class task
{
public:
task()
{
// ...
}
~task()
{
// ...
}
void done()
{
sig_finished(this);
}
/// signals
boost::signal sig_finished;
};
class bucket
{
public:
bucket()
{
// ...
}
~bucket()
{
// ...
}
void on_finished(task * t)
{
std::cout << "on_finished:\n";
}
void set_task(task * t)
{
t->sig_finished.connect(boost::bind(
&bucket::on_finished, this, t));
}
};
} // namepace jc
using namespace jc;
int main()
{
task * t = new task;
bucket * b = new bucket;
b->set_task(t);
t->done();
delete t;
delete b;
return 0;
}