NAME
ACE_Future -
This class implements a ``single write, multiple read'' pattern
that can be used to return results from asynchronous method
invocations.
SYNOPSIS
#include <ace/Future.h>
template<class T>
class ACE_Future
{
public:
ACE_Future (void);
ACE_Future (const ACE_Future<T> &r);
ACE_Future (const T &r);
~ACE_Future (void);
void operator = (const ACE_Future<T> &r);
int cancel (const T &r);
int operator == (const ACE_Future<T> &r) const;
int operator != (const ACE_Future<T> &r) const;
int set (const T &r);
int get (T &value, ACE_Time_Value *tv = 0);
operator T ();
int ready (void);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
ACE_Future_Rep<T> *create_rep_i (void) const;
void* operator new (size_t nbytes);
void operator delete(void *);
void operator &();
ACE_Future_Rep<T> *future_rep_;
ACE_Thread_Mutex mutex_;
};
DESCRIPTION
Initialization and termination methods.
ACE_Future (void);
ACE_Future (const ACE_Future<T> &r);
Copy constructor binds this and r to the same
ACE_Future_Rep. An ACE_Future_Rep is created if necessary.
ACE_Future (const T &r);
Constructor that initialises an ACE_Future to point to the
result r immediately.
~ACE_Future (void);
void operator = (const ACE_Future<T> &r);
Assignment operator that binds this and r to the same
ACE_Future_Rep. An ACE_Future_Rep is created if necessary.
int cancel (const T &r);
Cancel an ACE_Future and assign the value r. It is used if a
client does not want to wait for T to be produced.
int operator == (const ACE_Future<T> &r) const;
Equality operator that returns 1 if both ACE_FutureT objects
point to the same ACE_Future_RepT object. Attention: It also
returns 1 if both objects have just been instantiated and not
used yet.
int operator != (const ACE_Future<T> &r) const;
Inequality operator, which is the opposite of equality.
int set (const T &r);
Make the result available. Is used by the server thread to give
the result to all waiting clients.
int get (T &value, ACE_Time_Value *tv = 0);
Wait up to tv time to get the value.
operator T ();
type conversion. obtain the result of the asynchronous method
invocation. will block forever.
int ready (void);
Check if the result is available.
void dump (void) const;
Dump the state of an object.
ACE_ALLOC_HOOK_DECLARE;
Declare the dynamic allocation hooks.
AUTHOR
Andres Kruse Andres.Kruse@cern.ch and Douglas C. Schmidt
schmidt@cs.wustl.edu
LIBRARY
ace