Poco

template < class ResultType >

class ActiveResultHolder

File Information

Library: Foundation
Package: Threading
Header: Poco/ActiveResult.h

Description

This class holds the result of an asynchronous method invocation. It is used to pass the result from the execution thread back to the invocation thread. The class uses reference counting for memory management. Do not use this class directly, use ActiveResult instead.

Inheritance

Direct Base Classes: RefCountedObject

All Base Classes: RefCountedObject

Member Summary

Member Functions: data, error, exception, failed, notify, tryWait, wait

Inherited Functions: duplicate, referenceCount, release

Constructors

ActiveResultHolder inline

ActiveResultHolder();

Creates an ActiveResultHolder.

Destructor

~ActiveResultHolder protected virtual inline

~ActiveResultHolder();

Member Functions

data inline

ResultType & data();

Returns a reference to the actual result.

data inline

void data(
    ResultType * pData
);

error inline

std::string error() const;

If the active method threw an exception, a textual representation of the exception is returned. An empty string is returned if the active method completed successfully.

error inline

void error(
    const Exception & exc
);

Sets the exception.

error inline

void error(
    const std::string & msg
);

Sets the exception.

exception inline

Exception * exception() const;

If the active method threw an exception, a clone of the exception object is returned, otherwise null.

failed inline

bool failed() const;

Returns true if the active method failed (and threw an exception). Information about the exception can be obtained by calling error().

notify inline

void notify();

Notifies the invoking thread that the result became available.

tryWait inline

bool tryWait(
    long milliseconds
);

Waits up to the specified interval for the result to become available. Returns true if the result became available, false otherwise.

wait inline

void wait();

Pauses the caller until the result becomes available.

wait inline

void wait(
    long milliseconds
);

Waits up to the specified interval for the result to become available. Throws a TimeoutException if the result did not became available.