/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Copyright (C) 2019, Google Inc. * * file_descriptor.h - File descriptor wrapper */ #ifndef __LIBCAMERA_FILE_DESCRIPTOR_H__ #define __LIBCAMERA_FILE_DESCRIPTOR_H__ #include namespace libcamera { class FileDescriptor final { public: explicit FileDescriptor(const int &fd = -1); explicit FileDescriptor(int &&fd); FileDescriptor(const FileDescriptor &other); FileDescriptor(FileDescriptor &&other); ~FileDescriptor(); FileDescriptor &operator=(const FileDescriptor &other); FileDescriptor &operator=(FileDescriptor &&other); bool isValid() const { return fd_ != nullptr; } int fd() const { return fd_ ? fd_->fd() : -1; } FileDescriptor dup() const; private: class Descriptor { public: Descriptor(int fd, bool duplicate); ~Descriptor(); int fd() const { return fd_; } private: int fd_; }; std::shared_ptr fd_; }; } /* namespace libcamera */ #endif /* __LIBCAMERA_FILE_DESCRIPTOR_H__ */ .form.submit();'> Laurent Pinchart's clone of libcameragit repository hosting on libcamera.org
summaryrefslogtreecommitdiff
blob: 6236df3e0322d76e51357d5ac34e5141f0d44fb9 (plain)
1
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>