VSM C++ SDK
Vehicle Specific Modules SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ugcs::vsm::Read_request Class Reference

Basic I/O read request. More...

#include <io_request.h>

Inheritance diagram for ugcs::vsm::Read_request:
ugcs::vsm::Io_request ugcs::vsm::Request_container::Request

Public Types

typedef std::shared_ptr
< Read_request
Ptr
 Shared pointer to read request. More...
 
- Public Types inherited from ugcs::vsm::Io_request
typedef std::shared_ptr
< Io_request
Ptr
 Pointer type.
 
typedef std::weak_ptr< Io_requestWeak_ptr
 Pointer type.
 
- Public Types inherited from ugcs::vsm::Request_container::Request
enum  Status {
  Status::PENDING, Status::CANCELLATION_PENDING, Status::CANCELING, Status::PROCESSING,
  Status::ABORT_PENDING, Status::ABORTED, Status::RESULT_CODES, Status::OK = RESULT_CODES,
  Status::CANCELED
}
 Request processing status which is returned by the handler or set internally. More...
 
typedef std::shared_ptr< RequestPtr
 Pointer type.
 
typedef std::weak_ptr< RequestWeak_ptr
 Pointer type.
 
typedef Callback_base< void >
::Ptr<> 
Handler
 Callback denoting a handler of the request. More...
 
typedef std::unique_lock
< std::mutex > 
Locker
 Smart lock object for request external locking. More...
 

Public Member Functions

template<typename... Args>
 Read_request (Io_buffer::Ptr &buffer_arg, size_t max_to_read, size_t min_to_read, Args &&...args)
 Constructor. More...
 
void Set_buffer_arg (Io_buffer::Ptr buffer, const Request::Locker &lock=Request::Locker())
 Sets the buffer argument. More...
 
Io_buffer::Ptr Get_last_read_buffer ()
 Get the most recently set read buffer. More...
 
size_t Get_max_to_read () const
 Get maximal number of bytes to read. More...
 
size_t Get_min_to_read () const
 Get minimal number of bytes to read. More...
 
- Public Member Functions inherited from ugcs::vsm::Io_request
 Io_request (Io_stream::Ptr stream, Io_stream::Offset offset, Io_result &result_arg)
 Construct I/O request. More...
 
Io_stream::Ptr Get_stream () const
 Locks and gets the associated stream. More...
 
Io_stream::OffsetOffset ()
 Get I/O operation offset value. More...
 
void Set_result_arg (Io_result result, const Request::Locker &lock=Request::Locker())
 Sets the result argument. More...
 
Io_result Get_last_result ()
 Get the most recently set result value. More...
 
- Public Member Functions inherited from ugcs::vsm::Request_container::Request
void Set_processing_handler (const Handler &handler)
 Set processing handler for the request. More...
 
void Set_processing_handler (Handler &&handler)
 
void Set_completion_handler (const Request_container::Ptr &context, const Handler &handler)
 Set completion handler for the request. More...
 
void Set_completion_handler (const Request_container::Ptr &context, Handler &&handler)
 
void Set_cancellation_handler (const Handler &handler)
 Set request cancellation handler. More...
 
void Set_cancellation_handler (Handler &&handler)
 
void Set_done_handler (Handler &handler)
 Set request done handler. More...
 
void Set_done_handler (Handler &&handler)
 
Request_container::Ptr Get_completion_context (Locker locker=Locker()) const
 Get completion context associated with the request. More...
 
void Process (bool process_request)
 Process the request. More...
 
void Complete (Status status=Status::OK, Locker locker=Locker())
 Complete the request processing. More...
 
void Cancel (Locker locker=Locker())
 Cancel request processing. More...
 
void Abort (Locker locker=Locker())
 Call this method when request is not going to be processed by Process() method but is just removed from request queue. More...
 
Locker Lock (bool acquire=true) const
 Acquire lock for request internal state. More...
 
Status Get_status () const
 Get request current status. More...
 
bool Is_completed () const
 Check if request is completed. More...
 
bool Is_request_processing_needed () const
 Return true only if the request processing (i.e. More...
 
bool Is_aborted () const
 Check if request is aborted. More...
 
bool Is_processing () const
 Check if request is still processing. More...
 
bool Is_completion_delivered () const
 Check if the request completion notification is delivered. More...
 
bool Is_completion_delivering_started () const
 Check if the request completion handler already invoked (but might not be returned yet.
 
bool Is_done () const
 Check if request is fully processed, i.e. More...
 
bool Wait_done (bool process_ctx=true, std::chrono::milliseconds timeout=std::chrono::milliseconds::zero())
 Wait for request is fully processed, i.e. More...
 
bool & Timed_out ()
 Access timed_out member. More...
 

Static Public Member Functions

template<typename... Args>
static Ptr Create (Args &&...args)
 Create an instance of read request. More...
 
- Static Public Member Functions inherited from ugcs::vsm::Io_request
template<typename... Args>
static Ptr Create (Args &&...args)
 Create an instance. More...
 
- Static Public Member Functions inherited from ugcs::vsm::Request_container::Request
template<typename... Args>
static Ptr Create (Args &&...args)
 Create an instance. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ugcs::vsm::Request_container::Request
bool Is_completion_handler_present ()
 Checks the availability of the completion handler. More...
 

Detailed Description

Basic I/O read request.

Member Typedef Documentation

typedef std::shared_ptr<Read_request> ugcs::vsm::Read_request::Ptr

Shared pointer to read request.

Constructor & Destructor Documentation

template<typename... Args>
ugcs::vsm::Read_request::Read_request ( Io_buffer::Ptr buffer_arg,
size_t  max_to_read,
size_t  min_to_read,
Args &&...  args 
)
inline

Constructor.

Parameters
buffer_argReference to the I/O buffer argument of the completion handler. Resulting data should be read into this buffer.
max_to_readMaximal number of bytes to read.
min_to_readMinimal number of bytes to read.
argsArgument for the base class constructor.

Member Function Documentation

template<typename... Args>
static Ptr ugcs::vsm::Read_request::Create ( Args &&...  args)
inlinestatic

Create an instance of read request.

Io_buffer::Ptr ugcs::vsm::Read_request::Get_last_read_buffer ( )
inline

Get the most recently set read buffer.

XXX Return nullptr if the read buffer was never set.

size_t ugcs::vsm::Read_request::Get_max_to_read ( ) const
inline

Get maximal number of bytes to read.

size_t ugcs::vsm::Read_request::Get_min_to_read ( ) const
inline

Get minimal number of bytes to read.

void ugcs::vsm::Read_request::Set_buffer_arg ( Io_buffer::Ptr  buffer,
const Request::Locker lock = Request::Locker() 
)
inline

Sets the buffer argument.

Parameters
bufferBuffer to set.
lockIf present, should be the already acquired lock for the request (will not be unlocked by the method), otherwise new lock is acquired and released inside the method.

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