MySQL 8.0.39
Source Code Documentation
ddl::Unique_os_file_descriptor Class Reference

Captures ownership and manages lifetime of an already opened OS file descriptor. More...

#include <ddl0ddl.h>

Inheritance diagram for ddl::Unique_os_file_descriptor:
[legend]

Public Member Functions

 Unique_os_file_descriptor ()=default
 Default constructor, does not hold any file, does not close any on destruction. More...
 
 Unique_os_file_descriptor (os_fd_t fd)
 Main constructor capturing an already opened OS file descriptor. More...
 
 Unique_os_file_descriptor (Unique_os_file_descriptor &&other)
 
 ~Unique_os_file_descriptor ()
 
os_fd_t get () const
 Returns the managed OS file descriptor for use with OS functions that operate on file. More...
 
bool is_open () const
 
Unique_os_file_descriptoroperator= (Unique_os_file_descriptor &&other)
 
void swap (Unique_os_file_descriptor &other)
 Swaps the underlying managed file descriptors between two instances of Unique_os_file_descriptor. More...
 
void close ()
 Closes the managed file. More...
 

Private Attributes

os_fd_t m_fd {OS_FD_CLOSED}
 

Additional Inherited Members

- Private Member Functions inherited from ut::Non_copyable
 Non_copyable (const Non_copyable &)=delete
 
Non_copyableoperator= (const Non_copyable &)=delete
 
 Non_copyable ()=default
 
 ~Non_copyable ()=default
 

Detailed Description

Captures ownership and manages lifetime of an already opened OS file descriptor.

Closes the file on object destruction.

Constructor & Destructor Documentation

◆ Unique_os_file_descriptor() [1/3]

ddl::Unique_os_file_descriptor::Unique_os_file_descriptor ( )
default

Default constructor, does not hold any file, does not close any on destruction.

◆ Unique_os_file_descriptor() [2/3]

ddl::Unique_os_file_descriptor::Unique_os_file_descriptor ( os_fd_t  fd)
inline

Main constructor capturing an already opened OS file descriptor.

◆ Unique_os_file_descriptor() [3/3]

ddl::Unique_os_file_descriptor::Unique_os_file_descriptor ( Unique_os_file_descriptor &&  other)
inline

◆ ~Unique_os_file_descriptor()

ddl::Unique_os_file_descriptor::~Unique_os_file_descriptor ( )
inline

Member Function Documentation

◆ close()

void ddl::Unique_os_file_descriptor::close ( void  )
inline

Closes the managed file.

Leaves the instance in the same state as default constructed instance.

◆ get()

os_fd_t ddl::Unique_os_file_descriptor::get ( ) const
inline

Returns the managed OS file descriptor for use with OS functions that operate on file.

Do not close this file.

◆ is_open()

bool ddl::Unique_os_file_descriptor::is_open ( ) const
inline

◆ operator=()

Unique_os_file_descriptor & ddl::Unique_os_file_descriptor::operator= ( Unique_os_file_descriptor &&  other)
inline

◆ swap()

void ddl::Unique_os_file_descriptor::swap ( Unique_os_file_descriptor other)
inline

Swaps the underlying managed file descriptors between two instances of Unique_os_file_descriptor.

No files are closed.

Member Data Documentation

◆ m_fd

os_fd_t ddl::Unique_os_file_descriptor::m_fd {OS_FD_CLOSED}
private

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