FileDescriptor Class Reference

Space-ng SDK: sol3::core::FileDescriptor Class Reference
Space-ng SDK
sol3::core::FileDescriptor Class Reference

RAII wrapper for POSIX file descriptors. More...

#include <sol3/core/file_descriptor.h>

Public Member Functions

 FileDescriptor (int fd=-1)
 Constructs a FileDescriptor. More...
 
 ~FileDescriptor ()
 
 FileDescriptor (FileDescriptor const &)=delete
 
FileDescriptoroperator= (FileDescriptor const &)=delete
 
 FileDescriptor (FileDescriptor &&other) noexcept
 
FileDescriptoroperator= (FileDescriptor &&other) noexcept
 
bool isOpen () const
 Return true if the file descriptor is open, false otherwise. More...
 
int get () const
 Return the underlying file descriptor. More...
 
void reset (int fd=-1)
 Closes and replaces the underlying file descriptor. More...
 

Detailed Description

RAII wrapper for POSIX file descriptors.

Automatically closes the file descriptor when the object is destroyed.

Constructor & Destructor Documentation

◆ FileDescriptor() [1/3]

sol3::core::FileDescriptor::FileDescriptor ( int  fd = -1)
explicit

Constructs a FileDescriptor.

Parameters
fThe file descriptor to manage.

◆ ~FileDescriptor()

sol3::core::FileDescriptor::~FileDescriptor ( )

◆ FileDescriptor() [2/3]

sol3::core::FileDescriptor::FileDescriptor ( FileDescriptor const &  )
delete

◆ FileDescriptor() [3/3]

sol3::core::FileDescriptor::FileDescriptor ( FileDescriptor &&  other)
noexcept

Member Function Documentation

◆ get()

int sol3::core::FileDescriptor::get ( ) const

Return the underlying file descriptor.

◆ isOpen()

bool sol3::core::FileDescriptor::isOpen ( ) const

Return true if the file descriptor is open, false otherwise.

◆ operator=() [1/2]

FileDescriptor& sol3::core::FileDescriptor::operator= ( FileDescriptor &&  other)
noexcept

◆ operator=() [2/2]

FileDescriptor& sol3::core::FileDescriptor::operator= ( FileDescriptor const &  )
delete

◆ reset()

void sol3::core::FileDescriptor::reset ( int  fd = -1)

Closes and replaces the underlying file descriptor.


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