Own a working-file descriptor through success and exception paths. More...
#include <map_storage.h>
Public Member Functions | |
| StorageDescriptor (int descriptor=-1) | |
| Adopt a descriptor without duplicating it. | |
| StorageDescriptor (const StorageDescriptor &)=delete | |
| Noncopyable: ownership cannot be shared by copying the FD number. | |
| StorageDescriptor & | operator= (const StorageDescriptor &)=delete |
| Nonassignable: use reset() to replace the owned descriptor. | |
| ~StorageDescriptor () | |
| Close an owned descriptor; use close() when the status matters. | |
| int | get () const |
| Borrow the descriptor without transferring ownership. | |
| void | reset (int descriptor) |
| Relinquish the old descriptor and adopt a distinct replacement. | |
| int | close () |
| Close explicitly and report the system call result. | |
Private Attributes | |
| int | descriptor_ |
Detailed Description
Own a working-file descriptor through success and exception paths.
Definition at line 45 of file map_storage.h.
Constructor & Destructor Documentation
◆ StorageDescriptor() [1/2]
|
inlineexplicit |
Adopt a descriptor without duplicating it.
- Parameters
-
descriptor Owned descriptor, or -1 for no open file.
Definition at line 50 of file map_storage.h.
◆ StorageDescriptor() [2/2]
|
delete |
Noncopyable: ownership cannot be shared by copying the FD number.
◆ ~StorageDescriptor()
|
inline |
Close an owned descriptor; use close() when the status matters.
Definition at line 56 of file map_storage.h.
Member Function Documentation
◆ close()
|
inline |
Close explicitly and report the system call result.
- Returns
- Close status; the owner is empty even when close fails.
Clear ownership first so destruction cannot close a reused number.
Definition at line 70 of file map_storage.h.
◆ get()
|
inline |
Borrow the descriptor without transferring ownership.
- Returns
- Open descriptor number, or -1.
Definition at line 59 of file map_storage.h.
◆ operator=()
|
delete |
Nonassignable: use reset() to replace the owned descriptor.
◆ reset()
|
inline |
Relinquish the old descriptor and adopt a distinct replacement.
- Parameters
-
descriptor New owned descriptor, or -1 to leave the slot empty.
The old close status is not reported; do not pass get() back in.
Definition at line 63 of file map_storage.h.
Field Documentation
◆ descriptor_
|
private |
Definition at line 46 of file map_storage.h.
The documentation for this class was generated from the following file:
- modules/pangea/map_storage.h