STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
request_with_state.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/io/request_with_state.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2008 Andreas Beckmann <[email protected]>
7  * Copyright (C) 2009 Johannes Singler <[email protected]>
8  *
9  * Distributed under the Boost Software License, Version 1.0.
10  * (See accompanying file LICENSE_1_0.txt or copy at
11  * http://www.boost.org/LICENSE_1_0.txt)
12  **************************************************************************/
13 
14 #ifndef STXXL_IO_REQUEST_WITH_STATE_HEADER
15 #define STXXL_IO_REQUEST_WITH_STATE_HEADER
16 
18 #include <stxxl/bits/io/request.h>
20 #include <stxxl/bits/namespace.h>
21 
22 
24 
25 //! \addtogroup fileimpl
26 //! \{
27 
28 //! Request with completion state.
30 {
31 protected:
32  //! states of request
33  //! OP - operating, DONE - request served, READY2DIE - can be destroyed
34  enum request_state { OP = 0, DONE = 1, READY2DIE = 2 };
35 
37 
38 protected:
40  const completion_handler& on_cmpl,
41  file* f,
42  void* buf,
43  offset_type off,
44  size_type b,
45  request_type t) :
46  request(on_cmpl, f, buf, off, b, t),
47  _state(OP)
48  { }
49 
50 public:
51  virtual ~request_with_state();
52  void wait(bool measure_time = true);
53  bool poll();
54  bool cancel();
55 };
56 
57 //! \}
58 
60 
61 #endif // !STXXL_IO_REQUEST_WITH_STATE_HEADER
62 // vim: et:ts=4:sw=4
Completion handler class (Loki-style).
state< request_state > _state
Request with completion state.
Request that is aware of threads waiting for it to complete.
request_with_state(const completion_handler &on_cmpl, file *f, void *buf, offset_type off, size_type b, request_type t)
Defines interface of file.
Definition: file.h:52
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
stxxl::internal_size_type size_type
stxxl::external_size_type offset_type
Request with basic properties like file and offset.
Definition: request.h:39
request_state
states of request OP - operating, DONE - request served, READY2DIE - can be destroyed ...
#define STXXL_END_NAMESPACE
Definition: namespace.h:17