3 * Author: Lukas Krejci <krejci.l@centrum.cz>, (C) 2008
4 * Copyright: See COPYING file that comes with this distribution
7 #ifndef BEACONS_FUTURE_EVENT_H
8 #define BEACONS_FUTURE_EVENT_H
10 #include <beacons/future.hpp>
11 #include <beacons/detail/future_event_base.hpp>
16 * An implementation of the future interface that cooperates with
19 template<typename ResultType
>
20 class future_event
: public future
<ResultType
>, public detail::future_event_base
{
23 future_event() : future_event_base() {
26 /** currently always fails returning false */
28 return this->future_event_base::cancel();
31 bool finished() const {
32 return this->future_event_base::finished();
35 ResultType
get() throw (execution_exception
) {
36 ResultType
* ret
= static_cast<ResultType
*>(this->future_event_base::get());
41 ResultType
get(int timeout
) throw(execution_exception
, timeout_exception
) {
42 ResultType
* ret
= static_cast<ResultType
*>(this->future_event_base::get(timeout
));
49 class future_event
<void> : public future
<void>, public detail::future_event_base
{
52 future_event() : future_event_base() {
55 /** currently always fails returning false */
57 return this->future_event_base::cancel();
60 bool finished() const {
61 return this->future_event_base::finished();
64 void get() throw (execution_exception
) {
65 this->future_event_base::get();
68 void get(int timeout
) throw(execution_exception
, timeout_exception
) {
69 this->future_event_base::get();