Class Poco::ActiveResultHolder
Author: Applied Informatics Software Engineering GmbH and Contributors
Date: 2009-11-24

# Poco

# template < class ResultType >

# class ActiveResultHolder

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

ActiveResultHolder();

Creates an ActiveResultHolder.

## Destructor

### ~ActiveResultHolder

~ActiveResultHolder();

## Member Functions

### data

ResultType & data();

Returns a reference to the actual result.

### data

void data(
ResultType * pData
);

### error

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

void error(
const Exception & exc
);

Sets the exception.

### error

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

Sets the exception.

### exception

Exception * exception() const;

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

### failed

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

void notify();

Notifies the invoking thread that the result became available.

### tryWait

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

void wait();

Pauses the caller until the result becomes available.

### wait

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.