Lely core libraries
2.2.5
|
Go to the documentation of this file.
22 #ifndef LELY_IO_IO_HPP_
23 #define LELY_IO_IO_HPP_
26 #error "include <lely/io/io.h> for the C interface"
37 operator io_handle_t()
const noexcept {
return m_handle; }
51 operator=(
const IOHandle& handle) noexcept {
52 if (
this != &handle) {
61 operator=(
IOHandle&& handle) noexcept {
63 m_handle = handle.m_handle;
71 unique()
const noexcept {
83 getType()
const noexcept {
89 getFd()
const noexcept {
return io_get_fd(*
this); }
92 getFd()
const noexcept {
98 getFlags()
const noexcept {
103 setFlags(
int flags) noexcept {
108 read(
void* buf,
size_t nbytes) noexcept {
109 return io_read(*
this, buf, nbytes);
113 write(
const void* buf,
size_t nbytes) noexcept {
114 return io_write(*
this, buf, nbytes);
131 #endif // !LELY_IO_IO_HPP_
int io_get_type(io_handle_t handle)
Returns the type of an I/O device (one of IO_TYPE_CAN, IO_TYPE_FILE, IO_TYPE_PIPE,...
int io_close(io_handle_t handle)
Closes an I/O device.
void io_handle_release(io_handle_t handle)
Decrements the reference count of an I/O device handle.
int io_set_flags(io_handle_t handle, int flags)
Sets the flags of an I/O device.
int io_get_flags(io_handle_t handle)
Obtains the flags of an I/O device.
ssize_t io_read(io_handle_t handle, void *buf, size_t nbytes)
Performs a read operation.
io_handle_t io_handle_acquire(io_handle_t handle)
Increments the reference count of an I/O device handle.
#define IO_HANDLE_ERROR
The value of an invalid I/O device handle.
struct io_handle * io_handle_t
An opaque I/O device handle type.
int io_flush(io_handle_t handle)
Flushes the write buffer of a an I/O device.
int io_handle_unique(io_handle_t handle)
Returns 1 if there is only a single reference to the specified I/O device handle, and 0 otherwise.
int io_get_fd(io_handle_t handle)
Returns the native file descriptor of an I/O device.
ssize_t io_write(io_handle_t handle, const void *buf, size_t nbytes)
Performs a write operation.