Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Future_Rep Class Template Reference

ACE_Future_Rep<T>. More...

`#include <Future.h>`

Collaboration diagram for ACE_Future_Rep:

[legend]
List of all members.

## Private Types
typedef ACE_Future_Observer< T > | OBSERVER
typedef ACE_Unbounded_Set< OBSERVER *> | OBSERVER_COLLECTION
## Private Methods
int | set (const T &r, ACE_Future< T > &caller)
int | get (T &value, ACE_Time_Value *tv) const
| Wait up to <tv> time to get the <value>. Note that <tv> must be specified in absolute time rather than relative time. More...
int | attach (ACE_Future_Observer< T > *observer, ACE_Future< T > &caller)
int | detach (ACE_Future_Observer< T > *observer)
| operator T ()
void | dump (void) const
| Dump the state of an object. More...
int | ready (void) const
| Is result available? More...
| ACE_Future_Rep (void)
| ~ACE_Future_Rep (void)
## Static Private Methods
ACE_Future_Rep< T > * | internal_create (void)
| Allocate a new ACE_Future_Rep<T> instance, returning NULL if it cannot be created. More...
ACE_Future_Rep< T > * | create (void)
| Create a ACE_Future_Rep<T> and initialize the reference count. More...
ACE_Future_Rep< T > * | attach (ACE_Future_Rep< T > *&rep)
void | detach (ACE_Future_Rep< T > *&rep)
void | assign (ACE_Future_Rep< T > *&rep, ACE_Future_Rep< T > *new_rep)
## Private Attributes
| ACE_ALLOC_HOOK_DECLARE
| Declare the dynamic allocation hooks. More...
T * | value_
| Pointer to the result. More...
int | ref_count_
| Reference count. More...
OBSERVER_COLLECTION | observer_collection_
| Keep a list of ACE_Future_Observers unread by client's reader thread. More...
ACE_Thread_Mutex | value_ready_mutex_
ACE_Condition_Thread_Mutex | value_ready_
## Friends
class | ACE_Future< T >

## Detailed Description

### template<class T>
class ACE_Future_Rep< T >

ACE_Future_Rep<T>.

An ACE_Future_Rep<T> object encapsules a pointer to an object of class T which is the result of an asynchronous method invocation. It is pointed to by ACE_Future<T> object[s] and only accessible through them.

## Member Typedef Documentation

template<class T>
typedef ACE_Future_Observer<T> ACE_Future_Rep::OBSERVER`[private]`

template<class T>
typedef ACE_Unbounded_Set<OBSERVER *> ACE_Future_Rep::OBSERVER_COLLECTION`[private]`

## Constructor & Destructor Documentation

template<class T>
ACE_Future_Rep< T >::ACE_Future_Rep | ( | void |  | ) | `[private]`

template<class T>
ACE_Future_Rep< T >::~ACE_Future_Rep | ( | void |  | ) | `[private]`

## Member Function Documentation

template<class T>
void ACE_Future_Rep< T >::assign | ( | ACE_Future_Rep< T > *& | rep,
|  | ACE_Future_Rep< T > * | new_rep
| ) | `[static, private]`

| Decreases the rep's reference count and and deletes rep if there are no more references to rep. Then assigns new_rep to rep. Precondition (rep != 0 && new_rep != 0)

template<class T>
ACE_Future_Rep< T > * ACE_Future_Rep< T >::attach | ( | ACE_Future_Rep< T > *& | rep | ) | `[static, private]`

| Increase the reference count and return argument. Uses the attribute "value_ready_mutex_" to synchronize reference count updating. Precondition (rep != 0).

template<class T>
int ACE_Future_Rep< T >::attach | ( | ACE_Future_Observer< T > * | observer,
|  | ACE_Future< T > & | caller
| ) | `[private]`

| Attaches the specified observer to a subject (i.e. the <ACE_Future_Rep>). The update method of the specified subject will be invoked with a copy of the written-to <ACE_Future> as input when the result gets set. Returns 0 if the observer is successfully attached, 1 if the observer is already attached, and -1 if failures occur.

template<class T>
ACE_Future_Rep< T > * ACE_Future_Rep< T >::create | ( | void |  | ) | `[static, private]`

| Create a ACE_Future_Rep<T> and initialize the reference count.

template<class T>
void ACE_Future_Rep< T >::detach | ( | ACE_Future_Rep< T > *& | rep | ) | `[static, private]`

| Decreases the reference count and and deletes rep if there are no more references to rep. Precondition (rep != 0)

template<class T>
int ACE_Future_Rep< T >::detach | ( | ACE_Future_Observer< T > * | observer | ) | `[private]`

| Detaches the specified observer from a subject (i.e. the <ACE_Future_Rep>). The update method of the specified subject will not be invoked when the <ACE_Future_Rep>s result gets set. Returns 1 if the specified observer was actually attached to the subject prior to this call and 0 if was not. Returns 0 if the observer was successfully detached, and -1 if the observer was not attached in the first place.

template<class T>
void ACE_Future_Rep< T >::dump | ( | void |  | ) | const`[private]`

| Dump the state of an object.

template<class T>
int ACE_Future_Rep< T >::get | ( | T & | value,
|  | ACE_Time_Value * | tv
| ) | const`[private]`

| Wait up to <tv> time to get the <value>. Note that <tv> must be specified in absolute time rather than relative time.

template<class T>
ACE_Future_Rep< T > * ACE_Future_Rep< T >::internal_create | ( | void |  | ) | `[static, private]`

| Allocate a new ACE_Future_Rep<T> instance, returning NULL if it cannot be created.

template<class T>
ACE_Future_Rep< T >::operator T | ( |  | ) | `[private]`

| Type conversion. will block forever until the result is available. Note that this method is going away in a subsequent release since it doesn't distinguish between failure results and success results (exceptions should be used, but they aren't portable...). The <get> method should be used instead since it separates the error value from the result, and also permits timeouts.

template<class T>
int ACE_Future_Rep< T >::ready | ( | void |  | ) | const`[private]`

| Is result available?

template<class T>
int ACE_Future_Rep< T >::set | ( | const T & | r,
|  | ACE_Future< T > & | caller
| ) | `[private]`

| Set the result value. The specified <caller> represents the future that invoked this <set> method, which is used to notify the list of future observers. Returns 0 for success, -1 on error. This function only has an effect the first time it is called for the object. Subsequent calls return 0 (success) but have no effect.

## Friends And Related Function Documentation

template<class T>
friend class ACE_Future< T >`[friend]`

## Member Data Documentation

template<class T>
ACE_Future_Rep::ACE_ALLOC_HOOK_DECLARE`[private]`

| Declare the dynamic allocation hooks.

template<class T>
OBSERVER_COLLECTION ACE_Future_Rep::observer_collection_`[private]`

| Keep a list of ACE_Future_Observers unread by client's reader thread.

template<class T>
int ACE_Future_Rep::ref_count_`[private]`

| Reference count.

template<class T>
T* ACE_Future_Rep::value_`[private]`

| Pointer to the result.

template<class T>
ACE_Condition_Thread_Mutex ACE_Future_Rep::value_ready_`[private]`

template<class T>
ACE_Thread_Mutex ACE_Future_Rep::value_ready_mutex_`[private]`

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

- Future.h
- Future.cpp