Stxxl  1.3.2
request_interface.h
1 /***************************************************************************
2  * include/stxxl/bits/io/request_interface.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2002 Roman Dementiev <[email protected]>
7  * Copyright (C) 2008, 2009, 2011 Andreas Beckmann <[email protected]>
8  * Copyright (C) 2009 Johannes Singler <[email protected]>
9  *
10  * Distributed under the Boost Software License, Version 1.0.
11  * (See accompanying file LICENSE_1_0.txt or copy at
12  * http://www.boost.org/LICENSE_1_0.txt)
13  **************************************************************************/
14 
15 #ifndef STXXL_IO__REQUEST_INTERFACE_H_
16 #define STXXL_IO__REQUEST_INTERFACE_H_
17 
18 #include <ostream>
19 
20 #include <stxxl/bits/namespace.h>
21 #include <stxxl/bits/noncopyable.h>
22 #include <stxxl/bits/common/types.h>
23 
24 
25 __STXXL_BEGIN_NAMESPACE
26 
29 
30 class onoff_switch;
31 
33 
37 class request_interface : private noncopyable
38 {
39 public:
40  typedef stxxl::external_size_type offset_type;
41  typedef stxxl::internal_size_type size_type;
42  enum request_type { READ, WRITE };
43 
44 public:
45  virtual bool add_waiter(onoff_switch * sw) = 0;
46  virtual void delete_waiter(onoff_switch * sw) = 0;
47 
48 protected:
49  virtual void notify_waiters() = 0;
50 
51 public:
52  // HACK!
53  virtual void serve() = 0;
54 
55 protected:
56  virtual void completed() = 0;
57 
58 public:
60  virtual void wait(bool measure_time = true) = 0;
61 
69  virtual bool cancel() = 0;
70 
73  virtual bool poll() = 0;
74 
77  virtual const char * io_type() const = 0;
78 
80  virtual std::ostream & print(std::ostream & out) const = 0;
81 
82  virtual ~request_interface()
83  { }
84 };
85 
87 
88 __STXXL_END_NAMESPACE
89 
90 #endif // !STXXL_IO__REQUEST_INTERFACE_H_
91 // vim: et:ts=4:sw=4
virtual const char * io_type() const =0
Identifies the type of I/O implementation.
virtual bool poll()=0
Polls the status of the request.
Functional interface of a request.
Definition: request_interface.h:37
virtual void wait(bool measure_time=true)=0
Suspends calling thread until completion of the request.
virtual std::ostream & print(std::ostream &out) const =0
Dumps properties of a request.
virtual bool cancel()=0
Cancel a request.