On this page: poco-1.3.6-all-doc/00100-GuidedTour.html, there is a teaser demonstrating the usage of ActiveMethod:
- Code: Select all
#include "Poco/ActiveMethod.h"
#include "Poco/ActiveResult.h"
#include <utility>
using Poco::ActiveMethod;
using Poco::ActiveResult;
class ActiveAdder
{
public:
ActiveObject(): activeAdd(this, &ActiveAdder::add)
{
}
ActiveMethod<int, std::pair<int, int>, ActiveAdder> add;
private:
int addImpl(const std::pair<int, int>& args)
{
return args.first + args.second;
}
};
int main(int argc, char** argv)
{
ActiveAdder adder;
ActiveResult<int> sum = adder.add(std::make_pair(1, 2));
// do other things
sum.wait();
std::cout << sum.data() << std::endl;
return 0;
}
It still lacks a line of
- Code: Select all
#include <iostream>
And the constructor should be written like this:
- Code: Select all
ActiveAdder() : add(this, &ActiveAdder::addImpl)





