iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
iox2::FileDescriptor Class Reference

#include <file_descriptor.hpp>

Public Member Functions

 FileDescriptor (const FileDescriptor &)=delete
 
auto operator= (const FileDescriptor &) -> FileDescriptor &=delete
 
 FileDescriptor (FileDescriptor &&rhs) noexcept
 
auto operator= (FileDescriptor &&rhs) noexcept -> FileDescriptor &
 
 ~FileDescriptor ()
 
auto unsafe_native_handle () const -> int32_t
 
auto as_view () const -> FileDescriptorView
 

Static Public Member Functions

static auto create_owning (int32_t file_descriptor) -> bb::Optional< FileDescriptor >
 
static auto create_non_owning (int32_t file_descriptor) -> bb::Optional< FileDescriptor >
 

Detailed Description

Contains a [FileDescriptor] that will be closed when the object owns the descriptor and goes out of scope.

Definition at line 66 of file file_descriptor.hpp.

Constructor & Destructor Documentation

◆ FileDescriptor() [1/2]

iox2::FileDescriptor::FileDescriptor ( const FileDescriptor )
delete

◆ FileDescriptor() [2/2]

iox2::FileDescriptor::FileDescriptor ( FileDescriptor &&  rhs)
noexcept

◆ ~FileDescriptor()

iox2::FileDescriptor::~FileDescriptor ( )

Member Function Documentation

◆ as_view()

auto iox2::FileDescriptor::as_view ( ) const -> FileDescriptorView

Creates a [FileDescriptorView] out of the [FileDescriptor]. The view is only valid as long as the [FileDescriptor] is living - otherwise it will be a dangling view.

◆ create_non_owning()

static auto iox2::FileDescriptor::create_non_owning ( int32_t  file_descriptor) -> bb::Optional< FileDescriptor >
static

Creates a new [FileDescriptor] object that does not own it. If the provided value is an invalid [FileDescriptor] it returns [bb::NULLOPT].

◆ create_owning()

static auto iox2::FileDescriptor::create_owning ( int32_t  file_descriptor) -> bb::Optional< FileDescriptor >
static

Creates a new [FileDescriptor] object that owns it. If the provided value is an invalid [FileDescriptor] it returns [bb::NULLOPT].

◆ operator=() [1/2]

auto iox2::FileDescriptor::operator= ( const FileDescriptor ) -> FileDescriptor &=delete
delete

◆ operator=() [2/2]

auto iox2::FileDescriptor::operator= ( FileDescriptor &&  rhs) -> FileDescriptor &
noexcept

◆ unsafe_native_handle()

auto iox2::FileDescriptor::unsafe_native_handle ( ) const -> int32_t

Returns the underlying [FileDescriptor] value.

Safety

  • the user shall not store the value in a variable otherwise lifetime issues may be encountered
  • do not manually close the file descriptor with a sys call

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