summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-11-29 21:01:55 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-04 23:05:07 +0200
commitf8d2f17a3db5ac490d7b505253a98d6795c2b630 (patch)
tree258190e362cf40c39e2c95da66aae006a13c30a3 /include
parent560f5cf998646ddc54a20dc1c7326012834d3204 (diff)
libcamera: base: shared_fd: Add comparison operators
Add == and != comparison operators between two SharedFD instances, and use them to replace manuel get() calls. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/base/shared_fd.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/libcamera/base/shared_fd.h b/include/libcamera/base/shared_fd.h
index 20219224..e53a8b88 100644
--- a/include/libcamera/base/shared_fd.h
+++ b/include/libcamera/base/shared_fd.h
@@ -46,4 +46,14 @@ private:
std::shared_ptr<Descriptor> fd_;
};
+static inline bool operator==(const SharedFD &lhs, const SharedFD &rhs)
+{
+ return lhs.get() == rhs.get();
+}
+
+static inline bool operator!=(const SharedFD &lhs, const SharedFD &rhs)
+{
+ return !(lhs == rhs);
+}
+
} /* namespace libcamera */