Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Poco::ActiveResultHolder< ResultType > Class Template Reference

#include <ActiveResult.h>

+ Inheritance diagram for Poco::ActiveResultHolder< ResultType >:
+ Collaboration diagram for Poco::ActiveResultHolder< ResultType >:

Public Member Functions

 ActiveResultHolder ()
 
ResultType & data ()
 Returns a reference to the actual result.
 
void data (ResultType *pData)
 
void wait ()
 Pauses the caller until the result becomes available.
 
bool tryWait (long milliseconds)
 
void wait (long milliseconds)
 
void notify ()
 Notifies the invoking thread that the result became available.
 
bool failed () const
 
std::string error () const
 
Exceptionexception () const
 
void error (const Exception &exc)
 Sets the exception.
 
void error (const std::string &msg)
 Sets the exception.
 
- Public Member Functions inherited from Poco::RefCountedObject
 RefCountedObject ()
 
void duplicate () const
 
void release () const noexcept
 Increments the object's reference count.
 
int referenceCount () const
 

Protected Member Functions

 ~ActiveResultHolder ()
 
- Protected Member Functions inherited from Poco::RefCountedObject
virtual ~RefCountedObject ()
 Returns the reference count.
 

Private Attributes

ResultType * _pData
 
Exception_pExc
 
Event _event
 

Detailed Description

template<class ResultType>
class Poco::ActiveResultHolder< ResultType >

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.

Definition at line 33 of file ActiveResult.h.

Constructor & Destructor Documentation

◆ ActiveResultHolder()

template<class ResultType >
Poco::ActiveResultHolder< ResultType >::ActiveResultHolder ( )
inline

Definition at line 41 of file ActiveResult.h.

◆ ~ActiveResultHolder()

template<class ResultType >
Poco::ActiveResultHolder< ResultType >::~ActiveResultHolder ( )
inlineprotected

Definition at line 130 of file ActiveResult.h.

Member Function Documentation

◆ data() [1/2]

template<class ResultType >
ResultType & Poco::ActiveResultHolder< ResultType >::data ( )
inline

Returns a reference to the actual result.

Definition at line 49 of file ActiveResult.h.

◆ data() [2/2]

template<class ResultType >
void Poco::ActiveResultHolder< ResultType >::data ( ResultType * pData)
inline

Definition at line 56 of file ActiveResult.h.

◆ error() [1/3]

template<class ResultType >
std::string Poco::ActiveResultHolder< ResultType >::error ( ) const
inline

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.

Definition at line 97 of file ActiveResult.h.

◆ error() [2/3]

template<class ResultType >
void Poco::ActiveResultHolder< ResultType >::error ( const Exception & exc)
inline

Sets the exception.

Definition at line 115 of file ActiveResult.h.

◆ error() [3/3]

template<class ResultType >
void Poco::ActiveResultHolder< ResultType >::error ( const std::string & msg)
inline

Sets the exception.

Definition at line 122 of file ActiveResult.h.

◆ exception()

template<class ResultType >
Exception * Poco::ActiveResultHolder< ResultType >::exception ( ) const
inline

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

Definition at line 108 of file ActiveResult.h.

◆ failed()

template<class ResultType >
bool Poco::ActiveResultHolder< ResultType >::failed ( ) const
inline

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

Definition at line 90 of file ActiveResult.h.

◆ notify()

template<class ResultType >
void Poco::ActiveResultHolder< ResultType >::notify ( )
inline

Notifies the invoking thread that the result became available.

Definition at line 84 of file ActiveResult.h.

◆ tryWait()

template<class ResultType >
bool Poco::ActiveResultHolder< ResultType >::tryWait ( long milliseconds)
inline

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

Definition at line 68 of file ActiveResult.h.

◆ wait() [1/2]

template<class ResultType >
void Poco::ActiveResultHolder< ResultType >::wait ( )
inline

Pauses the caller until the result becomes available.

Definition at line 62 of file ActiveResult.h.

◆ wait() [2/2]

template<class ResultType >
void Poco::ActiveResultHolder< ResultType >::wait ( long milliseconds)
inline

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

Definition at line 76 of file ActiveResult.h.

Member Data Documentation

◆ _event

template<class ResultType >
Event Poco::ActiveResultHolder< ResultType >::_event
private

Definition at line 139 of file ActiveResult.h.

◆ _pData

template<class ResultType >
ResultType* Poco::ActiveResultHolder< ResultType >::_pData
private

Definition at line 137 of file ActiveResult.h.

◆ _pExc

template<class ResultType >
Exception* Poco::ActiveResultHolder< ResultType >::_pExc
private

Definition at line 138 of file ActiveResult.h.


The documentation for this class was generated from the following file: