Stxxl  1.3.2
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
request_with_state Class Reference

Request with completion state. More...

#include <request_with_state.h>

Inheritance diagram for request_with_state:
Inheritance graph
[legend]
Collaboration diagram for request_with_state:
Collaboration graph
[legend]

Public Member Functions

void wait (bool measure_time=true)
 Suspends calling thread until completion of the request. More...
 
bool poll ()
 Polls the status of the request. More...
 
bool cancel ()
 Cancel a request. More...
 
- Public Member Functions inherited from request
int nref ()
 
 request (const completion_handler &on_compl, file *file__, void *buffer_, offset_type offset_, size_type bytes_, request_type type_)
 
fileget_file () const
 
void * get_buffer () const
 
offset_type get_offset () const
 
size_type get_size () const
 
request_type get_type () const
 
void check_alignment () const
 
std::ostream & print (std::ostream &out) const
 Dumps properties of a request. More...
 
void error_occured (const char *msg)
 Inform the request object that an error occurred during the I/O execution. More...
 
void error_occured (const std::string &msg)
 Inform the request object that an error occurred during the I/O execution. More...
 
void check_errors () throw (stxxl::io_error)
 Rises an exception if there were error with the I/O. More...
 
- Public Member Functions inherited from request_interface
virtual void serve ()=0
 
virtual const char * io_type () const =0
 Identifies the type of I/O implementation. More...
 

Protected Types

enum  request_state { OP = 0, DONE = 1, READY2DIE = 2 }
 

Protected Member Functions

 request_with_state (const completion_handler &on_cmpl, file *f, void *buf, offset_type off, size_type b, request_type t)
 
- Protected Member Functions inherited from request
void completed ()
 
void check_nref (bool after=false)
 
- Protected Member Functions inherited from request_with_waiters
bool add_waiter (onoff_switch *sw)
 
void delete_waiter (onoff_switch *sw)
 
void notify_waiters ()
 

Protected Attributes

state< request_state_state
 
- Protected Attributes inherited from request
completion_handler on_complete
 
int ref_cnt
 
compat_unique_ptr
< stxxl::io_error >::result 
error
 
mutex ref_cnt_mutex
 
filefile_
 
void * buffer
 
offset_type offset
 
size_type bytes
 
request_type type
 

Additional Inherited Members

- Public Types inherited from request_interface
enum  request_type { READ, WRITE }
 
typedef stxxl::external_size_type offset_type
 
typedef stxxl::internal_size_type size_type
 

Detailed Description

Request with completion state.

Member Enumeration Documentation

states of request OP - operating, DONE - request served, READY2DIE - can be destroyed

Member Function Documentation

bool request_with_state::cancel ( )
virtual

Cancel a request.

The request is canceled unless already being processed. However, cancelation cannot be guaranteed. Canceled requests must still be waited for in order to ensure correct operation. If the request was canceled successfully, the completion handler will not be called.

Returns
true iff the request was canceled successfully

Implements request_interface.

References file::get_queue_id().

bool request_with_state::poll ( )
virtual

Polls the status of the request.

Returns
true if request is completed, otherwise false

Implements request_interface.

References request::check_errors().

void request_with_state::wait ( bool  measure_time = true)
virtual

Suspends calling thread until completion of the request.

Implements request_interface.

References request::check_errors().


The documentation for this class was generated from the following files: