AFIO  v2.00 late alpha
afio_v2_xxx::native_handle_type Struct Reference

A native handle type used for wrapping file descriptors, process ids or HANDLEs. Unmanaged, wrap in a handle object to manage. More...

#include "native_handle_type.hpp"

Public Types

enum  bitfield__disposition : unsigned {
  invalid = 0U, readable = 1U << 0U, writable = 1U << 1U, append_only = 1U << 2U,
  overlapped = 1U << 4U, seekable = 1U << 5U, aligned_io = 1U << 6U, file = 1U << 8U,
  directory = 1U << 9U, symlink = 1U << 10U, multiplexer = 1U << 11U, process = 1U << 12U,
  section = 1U << 13U
}
 The type of handle. More...
 

Public Member Functions

constexpr native_handle_type ()
 Constructs a default instance.
 
constexpr native_handle_type (disposition _behaviour, int _fd) noexcept
 Construct from a POSIX file descriptor.
 
constexpr native_handle_type (disposition _behaviour, win::handle _h) noexcept
 Construct from a Windows HANDLE.
 
 native_handle_type (const native_handle_type &)=default
 Copy construct.
 
constexpr native_handle_type (native_handle_type &&o) noexcept
 Move construct.
 
native_handle_typeoperator= (const native_handle_type &)=default
 Copy assign.
 
constexpr native_handle_typeoperator= (native_handle_type &&o) noexcept
 Move assign.
 
void swap (native_handle_type &o) noexcept
 Swaps with another instance.
 
constexpr operator bool () const noexcept
 True if valid.
 
constexpr bool operator! () const noexcept
 True if invalid.
 
constexpr bool is_valid () const noexcept
 True if the handle is valid.
 
constexpr bool is_readable () const noexcept
 True if the handle is readable.
 
constexpr bool is_writable () const noexcept
 True if the handle is writable.
 
constexpr bool is_append_only () const noexcept
 True if the handle is append only.
 
constexpr bool is_overlapped () const noexcept
 True if overlapped.
 
constexpr bool is_seekable () const noexcept
 True if seekable.
 
constexpr bool requires_aligned_io () const noexcept
 True if requires aligned i/o.
 
constexpr bool is_regular () const noexcept
 True if a regular file or device.
 
constexpr bool is_directory () const noexcept
 True if a directory.
 
constexpr bool is_symlink () const noexcept
 True if a symlink.
 
constexpr bool is_multiplexer () const noexcept
 True if a multiplexer like BSD kqueues, Linux epoll or Windows IOCP.
 
constexpr bool is_process () const noexcept
 True if a process.
 
constexpr bool is_section () const noexcept
 True if a memory section.
 

Public Attributes

disposition behaviour
 
union {
   intptr_t   _init {-1}
 
   int   fd
 A POSIX file descriptor.
 
   int   pid
 A POSIX process identifier.
 
   win::handle   h
 A Windows HANDLE.
 
}; 
 The behaviour of the handle.
 

Detailed Description

A native handle type used for wrapping file descriptors, process ids or HANDLEs. Unmanaged, wrap in a handle object to manage.

Member Enumeration Documentation

◆ bitfield__disposition

The type of handle.

Enumerator
invalid 

Invalid handle.

readable 

Is readable.

writable 

Is writable.

append_only 

Is append only.

overlapped 

Requires additional synchronisation.

seekable 

Is seekable.

aligned_io 

Requires sector aligned i/o (typically 512 or 4096)

file 

Is a regular file.

directory 

Is a directory.

symlink 

Is a symlink.

multiplexer 

Is a kqueue/epoll/iocp.

process 

Is a child process.

section 

Is a memory section.

45  {
46  invalid = 0U, //!< Invalid handle
47 
48  readable = 1U << 0U, //!< Is readable
49  writable = 1U << 1U, //!< Is writable
50  append_only = 1U << 2U, //!< Is append only
51 
52  overlapped = 1U << 4U, //!< Requires additional synchronisation
53  seekable = 1U << 5U, //!< Is seekable
54  aligned_io = 1U << 6U, //!< Requires sector aligned i/o (typically 512 or 4096)
55 
56  file = 1U << 8U, //!< Is a regular file
57  directory = 1U << 9U, //!< Is a directory
58  symlink = 1U << 10U, //!< Is a symlink
59  multiplexer = 1U << 11U, //!< Is a kqueue/epoll/iocp
60  process = 1U << 12U, //!< Is a child process
61  section = 1U << 13U //!< Is a memory section
62  }
Is writable.
Definition: native_handle_type.hpp:49
Is a memory section.
Definition: native_handle_type.hpp:61
Is a symlink.
Definition: native_handle_type.hpp:58
Is seekable.
Definition: native_handle_type.hpp:53
Is readable.
Definition: native_handle_type.hpp:48
Is a regular file.
Definition: native_handle_type.hpp:56
Is a kqueue/epoll/iocp.
Definition: native_handle_type.hpp:59
Is a child process.
Definition: native_handle_type.hpp:60
Requires additional synchronisation.
Definition: native_handle_type.hpp:52
Is append only.
Definition: native_handle_type.hpp:50
Requires sector aligned i/o (typically 512 or 4096)
Definition: native_handle_type.hpp:54
Is a directory.
Definition: native_handle_type.hpp:57
Invalid handle.
Definition: native_handle_type.hpp:46

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