00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef STXXL_IO__REQUEST_WITH_STATE_H_
00015 #define STXXL_IO__REQUEST_WITH_STATE_H_
00016
00017 #include <stxxl/bits/common/state.h>
00018 #include <stxxl/bits/io/request.h>
00019 #include <stxxl/bits/io/request_with_waiters.h>
00020
00021
00022 __STXXL_BEGIN_NAMESPACE
00023
00026
00028 class request_with_state : public request, public request_with_waiters
00029 {
00030 protected:
00033 enum request_state { OP = 0, DONE = 1, READY2DIE = 2 };
00034
00035 state<request_state> _state;
00036
00037 protected:
00038 request_with_state(
00039 const completion_handler & on_cmpl,
00040 file * f,
00041 void * buf,
00042 offset_type off,
00043 size_type b,
00044 request_type t) :
00045 request(on_cmpl, f, buf, off, b, t),
00046 _state(OP)
00047 { }
00048
00049 public:
00050 virtual ~request_with_state();
00051 void wait(bool measure_time = true);
00052 bool poll();
00053 bool cancel();
00054 };
00055
00057
00058 __STXXL_END_NAMESPACE
00059
00060 #endif // !STXXL_IO__REQUEST_WITH_STATE_H_
00061