19 explicit SharedFD(
const int &fd = -1);
29 bool isValid()
const {
return fd_ !=
nullptr; }
30 int get()
const {
return fd_ ? fd_->fd() : -1; }
37 Descriptor(
int fd,
bool duplicate);
40 int fd()
const {
return fd_; }
46 std::shared_ptr<Descriptor> fd_;
51 return lhs.
get() == rhs.
get();
RAII-style wrapper for file descriptors.
Definition: shared_fd.h:16
~SharedFD()
Destroy the SharedFD instance.
Definition: shared_fd.cpp:160
UniqueFD dup() const
Duplicate a SharedFD.
Definition: shared_fd.cpp:254
Top-level libcamera namespace.
Definition: backtrace.h:17
unique_ptr-like wrapper for a file descriptor
Definition: unique_fd.h:17
bool isValid() const
Check if the SharedFD instance is valid.
Definition: shared_fd.h:29
SharedFD(const int &fd=-1)
Create a SharedFD copying a given fd.
Definition: shared_fd.cpp:75
int get() const
Retrieve the numerical file descriptor.
Definition: shared_fd.h:30
SharedFD & operator=(const SharedFD &other)
Copy assignment operator, replace the wrapped file descriptor with a copy of other.
Definition: shared_fd.cpp:177