3 * Author: Lukas Krejci <krejci.l@centrum.cz>, (C) 2008
4 * Copyright: See COPYING file that comes with this distribution
7 #ifndef BEACON_FUTURE_EVENT_H
8 #define BEACON_FUTURE_EVENT_H
10 #include <beacon/future.hpp>
11 #include <beacon/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 return static_cast<ResultType
>(*(this->future_event_base::get()));
39 ResultType
get(int timeout
) throw(execution_exception
, timeout_exception
) {
40 return static_cast<ResultType
>(*(this->future_event_base::get(timeout
)));
45 class future_event
<void> : public future
<void>, public detail::future_event_base
{
48 future_event() : future_event_base() {
51 /** currently always fails returning false */
53 return this->future_event_base::cancel();
56 bool finished() const {
57 return this->future_event_base::finished();
60 void get() throw (execution_exception
) {
61 this->future_event_base::get();
64 void get(int timeout
) throw(execution_exception
, timeout_exception
) {
65 this->future_event_base::get();