contur2
Loading...
Searching...
No Matches
contur::FileDescriptorTable Class Referencefinal

Descriptor table mapping integer handles to open-file state. More...

#include <file_descriptor.h>

Public Member Functions

 FileDescriptorTable ()
 ~FileDescriptorTable ()
 FileDescriptorTable (const FileDescriptorTable &)=delete
FileDescriptorTableoperator= (const FileDescriptorTable &)=delete
 FileDescriptorTable (FileDescriptorTable &&) noexcept
FileDescriptorTableoperator= (FileDescriptorTable &&) noexcept
Result< FileDescriptoropen (OpenFileState state)
 Creates a new descriptor entry.
Result< void > close (FileDescriptor fd)
 Removes a descriptor entry.
Result< OpenFileStateget (FileDescriptor fd) const
 Returns state for descriptor.
Result< void > set (FileDescriptor fd, OpenFileState state)
 Replaces state for descriptor.
bool contains (FileDescriptor fd) const noexcept
 Returns whether descriptor exists.
std::size_t openCount () const noexcept
 Count of currently open descriptors.

Private Attributes

std::unique_ptr< Impl > impl_

Detailed Description

Descriptor table mapping integer handles to open-file state.

Definition at line 84 of file file_descriptor.h.

Constructor & Destructor Documentation

◆ FileDescriptorTable() [1/3]

contur::FileDescriptorTable::FileDescriptorTable ( )

◆ ~FileDescriptorTable()

contur::FileDescriptorTable::~FileDescriptorTable ( )

◆ FileDescriptorTable() [2/3]

contur::FileDescriptorTable::FileDescriptorTable ( const FileDescriptorTable & )
delete

◆ FileDescriptorTable() [3/3]

contur::FileDescriptorTable::FileDescriptorTable ( FileDescriptorTable && )
noexcept

Member Function Documentation

◆ close()

Result< void > contur::FileDescriptorTable::close ( FileDescriptor fd)
nodiscard

Removes a descriptor entry.

Parameters
fdDescriptor to close.
Returns
Ok on success; NotFound if descriptor does not exist.

◆ contains()

bool contur::FileDescriptorTable::contains ( FileDescriptor fd) const
nodiscardnoexcept

Returns whether descriptor exists.

Parameters
fdDescriptor to test.
Returns
True when descriptor is open.

◆ get()

Result< OpenFileState > contur::FileDescriptorTable::get ( FileDescriptor fd) const
nodiscard

Returns state for descriptor.

Parameters
fdDescriptor to query.
Returns
Open-file state or NotFound.

◆ open()

Result< FileDescriptor > contur::FileDescriptorTable::open ( OpenFileState state)
nodiscard

Creates a new descriptor entry.

Parameters
stateInitial open-file state to store.
Returns
Newly allocated descriptor handle.

◆ openCount()

std::size_t contur::FileDescriptorTable::openCount ( ) const
nodiscardnoexcept

Count of currently open descriptors.

Returns
Number of open entries in table.

◆ operator=() [1/2]

FileDescriptorTable & contur::FileDescriptorTable::operator= ( const FileDescriptorTable & )
delete

◆ operator=() [2/2]

FileDescriptorTable & contur::FileDescriptorTable::operator= ( FileDescriptorTable && )
noexcept

◆ set()

Result< void > contur::FileDescriptorTable::set ( FileDescriptor fd,
OpenFileState state )
nodiscard

Replaces state for descriptor.

Parameters
fdDescriptor to update.
stateNew state value.
Returns
Ok on success; NotFound if descriptor does not exist.

Member Data Documentation

◆ impl_

std::unique_ptr<Impl> contur::FileDescriptorTable::impl_
private

Definition at line 127 of file file_descriptor.h.


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