#include <Future.h>
Collaboration diagram for ACE_Future< T >:
Public Member Functions | |
ACE_Future (void) | |
Constructor. | |
ACE_Future (const ACE_Future< T > &r) | |
ACE_Future (const T &r) | |
~ACE_Future (void) | |
Destructor. | |
void | operator= (const ACE_Future< T > &r) |
int | cancel (const T &r) |
int | cancel (void) |
bool | operator== (const ACE_Future< T > &r) const |
bool | operator!= (const ACE_Future< T > &r) const |
Inequality operator, which is the opposite of equality. | |
int | set (const T &r) |
int | get (T &value, ACE_Time_Value *tv=0) const |
operator T () | |
int | ready (void) const |
Check if the result is available. | |
int | attach (ACE_Future_Observer< T > *observer) |
int | detach (ACE_Future_Observer< T > *observer) |
void | dump (void) const |
Dump the state of an object. | |
ACE_Future_Rep< T > * | get_rep (void) |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Private Types | |
typedef ACE_Future_Rep< T > | FUTURE_REP |
Protect operations on the . | |
Private Attributes | |
FUTURE_REP * | future_rep_ |
Definition at line 241 of file Future.h.
|
Protect operations on the .
Definition at line 372 of file Future.h. Referenced by ACE_Future< T >::ACE_Future(). |
|
Constructor.
Definition at line 289 of file Future.cpp. References ACE_Future< T >::FUTURE_REP.
00290 : future_rep_ (FUTURE_REP::create ()) 00291 { 00292 } |
|
Copy constructor binds this and r to the same ACE_Future_Rep. An ACE_Future_Rep is created if necessary. Definition at line 295 of file Future.cpp. References ACE_Future< T >::FUTURE_REP.
00296 : future_rep_ (FUTURE_REP::attach (((ACE_Future<T> &) r).future_rep_)) 00297 { 00298 } |
|
Constructor that initialises an ACE_Future to point to the result r immediately. Definition at line 301 of file Future.cpp. References ACE_Future< T >::FUTURE_REP, ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::set().
00302 : future_rep_ (FUTURE_REP::create ()) 00303 { 00304 this->future_rep_->set (r, *this); 00305 } |
|
Destructor.
Definition at line 308 of file Future.cpp. References ACE_Future< T >::future_rep_.
00309 { 00310 FUTURE_REP::detach (future_rep_); 00311 } |
|
Attaches the specified observer to a subject (this ACE_Future). The update method of the specified subject will be invoked with a copy of the associated ACE_Future as input when the result gets set. If the result is already set when this method gets invoked, then the update method of the specified subject will be invoked immediately.
Definition at line 367 of file Future.cpp. References ACE_Future_Rep< T >::attach(), and ACE_Future< T >::future_rep_.
00368 { 00369 return this->future_rep_->attach (observer, *this); 00370 } |
|
Cancel an ACE_Future. Put the future into its initial state. Returns 0 on succes and -1 on failure. It is now possible to reuse the ACE_Future. But remember, the ACE_Future is now bound to a new ACE_Future_Rep. Definition at line 334 of file Future.cpp. Referenced by ACE_Future< T >::cancel().
00335 { 00336 // If this ACE_Future is already attached to a ACE_Future_Rep, 00337 // detach it (maybe delete the ACE_Future_Rep). 00338 FUTURE_REP::assign (this->future_rep_, 00339 FUTURE_REP::create ()); 00340 return 0; 00341 } |
|
Cancel an ACE_Future and assign the value r. It is used if a client does not want to wait for the value to be produced. Definition at line 326 of file Future.cpp. References ACE_Future< T >::cancel(), ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::set().
00327 { 00328 this->cancel (); 00329 return this->future_rep_->set (r, 00330 *this); 00331 } |
|
Detaches the specified observer from a subject (this ACE_Future). The update method of the specified subject will not be invoked when the ACE_Future_Rep result gets set.
Definition at line 373 of file Future.cpp. References ACE_Future_Rep< T >::detach(), and ACE_Future< T >::future_rep_.
00374 { 00375 return this->future_rep_->detach (observer); 00376 } |
|
Dump the state of an object.
Definition at line 410 of file Future.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_Future_Rep< T >::dump(), ACE_Future< T >::future_rep_, and LM_DEBUG.
00411 { 00412 #if defined (ACE_HAS_DUMP) 00413 ACE_DEBUG ((LM_DEBUG, 00414 ACE_BEGIN_DUMP, this)); 00415 00416 if (this->future_rep_) 00417 this->future_rep_->dump (); 00418 00419 ACE_DEBUG ((LM_DEBUG, 00420 ACE_END_DUMP)); 00421 #endif /* ACE_HAS_DUMP */ 00422 } |
|
Wait to get the object's value.
Definition at line 359 of file Future.cpp. References ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::get().
00361 { 00362 // We return the ACE_Future_rep. 00363 return this->future_rep_->get (value, tv); 00364 } |
|
Get the underlying ACE_Future_Rep pointer. Note that this method should rarely, if ever, be used and that modifying the underlying ACE_Future_Rep should be done with extreme caution. Definition at line 425 of file Future.cpp. References ACE_Future< T >::future_rep_. Referenced by ACE_Future_Set< T >::update().
00426 { 00427 return this->future_rep_; 00428 } |
|
Definition at line 379 of file Future.cpp. References ACE_Future< T >::future_rep_.
00380 { 00381 // note that this will fail (and COREDUMP!) 00382 // if future_rep_ == 0 ! 00383 // 00384 // but... 00385 // this is impossible unless somebody is so stupid to 00386 // try something like this: 00387 // 00388 // Future<T> futT; 00389 // T t; 00390 // t = futT; 00391 00392 // perform type conversion on Future_Rep. 00393 return *future_rep_; 00394 } |
|
Inequality operator, which is the opposite of equality.
Definition at line 320 of file Future.cpp. References ACE_Future< T >::future_rep_.
00321 { 00322 return r.future_rep_ != this->future_rep_; 00323 } |
|
Assignment operator that binds this and r to the same ACE_Future_Rep. An ACE_Future_Rep is created if necessary. Definition at line 397 of file Future.cpp. References ACE_Future< T >::future_rep_.
00398 { 00399 // assignment: 00400 // 00401 // bind <this> to the same <ACE_Future_Rep> as <r>. 00402 00403 // This will work if &r == this, by first increasing the ref count 00404 ACE_Future<T> &r = (ACE_Future<T> &) rhs; 00405 FUTURE_REP::assign (this->future_rep_, 00406 FUTURE_REP::attach (r.future_rep_)); 00407 } |
|
Equality operator that returns
Definition at line 314 of file Future.cpp. References ACE_Future< T >::future_rep_.
00315 { 00316 return r.future_rep_ == this->future_rep_; 00317 } |
|
Check if the result is available.
Definition at line 352 of file Future.cpp. References ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::ready().
00353 { 00354 // We're ready if the ACE_Future_rep is ready... 00355 return this->future_rep_->ready (); 00356 } |
|
Make the result available. Is used by the server thread to give the result to all waiting clients. Returns 0 for success, -1 on failure. This function only has an effect the first time it is called for the object (actually, the first time the underlying ACE_Future_Rep has a value assigned to it). Subsequent calls return 0 (success) but have no effect. Definition at line 344 of file Future.cpp. References ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::set().
00345 { 00346 // Give the pointer to the result to the ACE_Future_Rep. 00347 return this->future_rep_->set (r, 00348 *this); 00349 } |
|
Declare the dynamic allocation hooks.
|
|