![]() |
VSM C++ SDK
Vehicle Specific Modules SDK
|
POSIX-specific implementation of system native file handle. More...
#include <posix_file_handle.h>
Classes | |
struct | Io_cb |
Posix specific I/O control block. More... | |
Public Member Functions | |
Posix_file_handle (int fd, int write_fd=-1) | |
Construct an instance based on already opened descriptors. More... | |
Posix_file_handle (const std::string &path, const File_processor::Stream::Mode &mode, mode_t permissions=S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) | |
Construct an instance by opening a file specified by path. More... | |
virtual | ~Posix_file_handle () |
Closes descriptors on destruction. More... | |
![]() | |
void | Set_stream (Stream::Ptr stream) |
Set associated stream. More... | |
void | Handle_write_abort () |
Process write operation abortion. More... | |
void | Handle_read_abort () |
Process write operation abortion. More... | |
Protected Member Functions | |
virtual void | Write () override |
Schedule write operation based on current write request. More... | |
void | Write_complete_cbk () |
Completion handler for platform write call. More... | |
virtual void | Read () override |
Schedule read operation based on current read request. More... | |
void | Read_impl (std::unique_lock< std::mutex > &&read_lock) |
Implementation of read operation. More... | |
virtual File_processor::Stream::Lock_result | Try_lock () override |
Schedule lock operation based on current lock request. More... | |
virtual bool | Lock () override |
Schedule lock operation based on current lock request. More... | |
virtual bool | Unlock () override |
Schedule unlock operation based on current lock request. More... | |
void | Read_complete_cbk () |
Completion handler for platform read call. More... | |
virtual bool | Cancel_write () override |
Cancel current write operation. More... | |
virtual bool | Cancel_read () override |
Cancel current read operation. More... | |
virtual void | Close () override |
Close the handle. More... | |
Poll_io_controller & | Get_controller () const |
Get poll controller. More... | |
![]() | |
Stream_ref_holder | Set_write_activity (bool is_active, std::unique_lock< std::mutex > &&lock=std::unique_lock< std::mutex >()) |
Called by derived class to indicate whether platform call is currently active or not. More... | |
Stream_ref_holder | Set_read_activity (bool is_active, std::unique_lock< std::mutex > &&lock=std::unique_lock< std::mutex >()) |
Called by derived class to indicate whether platform call is currently active or not. More... | |
Native_controller & | Get_native_controller () const |
Get native controlled of the related stream. More... | |
Static Protected Member Functions | |
static void | Write_complete_cbk_s (Poll_io_controller::Io_cb &io_cb) |
Callback used as completion handler for platform write call. More... | |
static void | Read_complete_cbk_s (Poll_io_controller::Io_cb &io_cb) |
Callback used as completion handler for platform read call. More... | |
static Io_result | Map_error (int error) |
Map errno value to Io_result. More... | |
Protected Attributes | |
int | fd = -1 |
POSIX file descriptor for read/write operations. More... | |
int | write_fd = -1 |
Optional separate descriptor for write operations. More... | |
Io_cb | read_cb |
Control block for current read operation. More... | |
Io_cb | write_cb |
Control block for current write operation. More... | |
std::shared_ptr< std::vector < uint8_t > > | read_buf |
Read buffer. More... | |
std::mutex | write_mutex |
Mutex for protecting write control block. More... | |
std::mutex | read_mutex |
Mutex for protecting read control block. More... | |
size_t | min_read_size |
Minimal number of bytes to read in current read operation. More... | |
Additional Inherited Members | |
![]() | |
typedef std::unique_ptr < Native_handle > | Unique_ptr |
Unique pointer type. More... | |
![]() | |
Read_request::Ptr | cur_read_request |
Current read request. More... | |
Write_request::Ptr | cur_write_request |
Current write request. More... | |
Io_request::Ptr | cur_lock_request |
Current lock request. More... | |
Io_request::Ptr | cur_unlock_request |
Current unlock request. More... | |
bool | is_closed = false |
Is the handle already closed. More... | |
Stream::Ptr | stream |
Related stream. More... | |
Stream::Ptr | write_active |
Holds reference to a stream while write operation is in progress. More... | |
Stream::Ptr | read_active |
Holds reference to a stream while read operation is in progress. More... | |
POSIX-specific implementation of system native file handle.
ugcs::vsm::internal::Posix_file_handle::Posix_file_handle | ( | int | fd, |
int | write_fd = -1 |
||
) |
Construct an instance based on already opened descriptors.
ugcs::vsm::internal::Posix_file_handle::Posix_file_handle | ( | const std::string & | path, |
const File_processor::Stream::Mode & | mode, | ||
mode_t | permissions = S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH |
||
) |
Construct an instance by opening a file specified by path.
|
virtual |
Closes descriptors on destruction.
|
overrideprotectedvirtual |
Cancel current read operation.
Implements ugcs::vsm::File_processor::Stream::Native_handle.
|
overrideprotectedvirtual |
Cancel current write operation.
Implements ugcs::vsm::File_processor::Stream::Native_handle.
|
overrideprotectedvirtual |
Close the handle.
Implements ugcs::vsm::File_processor::Stream::Native_handle.
|
inlineprotected |
Get poll controller.
|
overrideprotectedvirtual |
Schedule lock operation based on current lock request.
Implements ugcs::vsm::File_processor::Stream::Native_handle.
|
staticprotected |
Map errno value to Io_result.
|
overrideprotectedvirtual |
Schedule read operation based on current read request.
Implements ugcs::vsm::File_processor::Stream::Native_handle.
|
protected |
Completion handler for platform read call.
|
staticprotected |
Callback used as completion handler for platform read call.
|
protected |
Implementation of read operation.
|
overrideprotectedvirtual |
Schedule lock operation based on current lock request.
Implements ugcs::vsm::File_processor::Stream::Native_handle.
|
overrideprotectedvirtual |
Schedule unlock operation based on current lock request.
Implements ugcs::vsm::File_processor::Stream::Native_handle.
|
overrideprotectedvirtual |
Schedule write operation based on current write request.
Implements ugcs::vsm::File_processor::Stream::Native_handle.
|
protected |
Completion handler for platform write call.
|
staticprotected |
Callback used as completion handler for platform write call.
|
protected |
POSIX file descriptor for read/write operations.
|
protected |
Minimal number of bytes to read in current read operation.
|
protected |
Read buffer.
|
protected |
Control block for current read operation.
|
protected |
Mutex for protecting read control block.
|
protected |
Control block for current write operation.
|
protected |
Optional separate descriptor for write operations.
|
protected |
Mutex for protecting write control block.