#include <ace/OS.h>
#include <ace/Future.h>
#include <ace/Method_Object.h>
//觀察者模式測試
class MyObserver : public ACE_Future_Observer<string>
{
virtual void update(const ACE_Future<string> &future)
{
string value;
future.get(value);
cout<<"change:/t"<<value<<endl;
}
};
int main (int argc, ACE_TCHAR *argv[])
{
//觀察者模式測試代碼
MyObserver obv;
Logger log;
ACE_Future<string> result;
result.attach(&obv);
log.LogMsgActive("hello", &result);
}
//侷限:只能對ACE_Future進行一次Set()操作