#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 291 of file Future.cpp. References ACE_Future< T >::FUTURE_REP.
00292 : future_rep_ (FUTURE_REP::create ()) 00293 { 00294 } |
|
Copy constructor binds this and r to the same ACE_Future_Rep. An ACE_Future_Rep is created if necessary. Definition at line 297 of file Future.cpp. References ACE_Future< T >::FUTURE_REP.
00298 : future_rep_ (FUTURE_REP::attach (((ACE_Future<T> &) r).future_rep_)) 00299 { 00300 } |
|
Constructor that initialises an ACE_Future to point to the result r immediately. Definition at line 303 of file Future.cpp. References ACE_Future< T >::FUTURE_REP, ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::set().
00304 : future_rep_ (FUTURE_REP::create ()) 00305 { 00306 this->future_rep_->set (r, *this); 00307 } |
|
Destructor.
Definition at line 310 of file Future.cpp. References ACE_Future< T >::future_rep_.
00311 { 00312 FUTURE_REP::detach (future_rep_); 00313 } |
|
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 369 of file Future.cpp. References ACE_Future_Rep< T >::attach(), and ACE_Future< T >::future_rep_.
00370 { 00371 return this->future_rep_->attach (observer, *this); 00372 } |
|
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 336 of file Future.cpp. Referenced by ACE_Future< T >::cancel().
00337 { 00338 // If this ACE_Future is already attached to a ACE_Future_Rep, 00339 // detach it (maybe delete the ACE_Future_Rep). 00340 FUTURE_REP::assign (this->future_rep_, 00341 FUTURE_REP::create ()); 00342 return 0; 00343 } |
|
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 328 of file Future.cpp. References ACE_Future< T >::cancel(), ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::set().
00329 { 00330 this->cancel (); 00331 return this->future_rep_->set (r, 00332 *this); 00333 } |
|
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 375 of file Future.cpp. References ACE_Future_Rep< T >::detach(), and ACE_Future< T >::future_rep_.
00376 { 00377 return this->future_rep_->detach (observer); 00378 } |
|
Dump the state of an object.
Definition at line 412 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.
00413 { 00414 #if defined (ACE_HAS_DUMP) 00415 ACE_DEBUG ((LM_DEBUG, 00416 ACE_BEGIN_DUMP, this)); 00417 00418 if (this->future_rep_) 00419 this->future_rep_->dump (); 00420 00421 ACE_DEBUG ((LM_DEBUG, 00422 ACE_END_DUMP)); 00423 #endif /* ACE_HAS_DUMP */ 00424 } |
|
Wait to get the object's value.
Definition at line 361 of file Future.cpp. References ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::get().
00363 { 00364 // We return the ACE_Future_rep. 00365 return this->future_rep_->get (value, tv); 00366 } |
|
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 427 of file Future.cpp. References ACE_Future< T >::future_rep_. Referenced by ACE_Future_Set< T >::update().
00428 { 00429 return this->future_rep_; 00430 } |
|
Definition at line 381 of file Future.cpp. References ACE_Future< T >::future_rep_.
00382 { 00383 // note that this will fail (and COREDUMP!) 00384 // if future_rep_ == 0 ! 00385 // 00386 // but... 00387 // this is impossible unless somebody is so stupid to 00388 // try something like this: 00389 // 00390 // Future<T> futT; 00391 // T t; 00392 // t = futT; 00393 00394 // perform type conversion on Future_Rep. 00395 return *future_rep_; 00396 } |
|
Inequality operator, which is the opposite of equality.
Definition at line 322 of file Future.cpp. References ACE_Future< T >::future_rep_.
00323 { 00324 return r.future_rep_ != this->future_rep_; 00325 } |
|
Assignment operator that binds this and r to the same ACE_Future_Rep. An ACE_Future_Rep is created if necessary. Definition at line 399 of file Future.cpp. References ACE_Future< T >::future_rep_.
00400 { 00401 // assignment: 00402 // 00403 // bind <this> to the same <ACE_Future_Rep> as <r>. 00404 00405 // This will work if &r == this, by first increasing the ref count 00406 ACE_Future<T> &r = (ACE_Future<T> &) rhs; 00407 FUTURE_REP::assign (this->future_rep_, 00408 FUTURE_REP::attach (r.future_rep_)); 00409 } |
|
Equality operator that returns
Definition at line 316 of file Future.cpp. References ACE_Future< T >::future_rep_.
00317 { 00318 return r.future_rep_ == this->future_rep_; 00319 } |
|
Check if the result is available.
Definition at line 354 of file Future.cpp. References ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::ready().
00355 { 00356 // We're ready if the ACE_Future_rep is ready... 00357 return this->future_rep_->ready (); 00358 } |
|
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 346 of file Future.cpp. References ACE_Future< T >::future_rep_, and ACE_Future_Rep< T >::set().
00347 { 00348 // Give the pointer to the result to the ACE_Future_Rep. 00349 return this->future_rep_->set (r, 00350 *this); 00351 } |
|
Declare the dynamic allocation hooks.
|
|