[PATCH v2 5/5] libcamera: controls: Add rvalue overload for `ControlList::set()`
Barnabás Pőcze
barnabas.pocze at ideasonboard.com
Mon Apr 21 17:35:56 CEST 2025
Add an overload of `ControlList::set()` that takes the `ControlValue` argument
as an rvalue reference, therefore enabling the use of move assignment.
Signed-off-by: Barnabás Pőcze <barnabas.pocze at ideasonboard.com>
---
include/libcamera/controls.h | 1 +
src/libcamera/controls.cpp | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index 62ee5ebd6..611252f20 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -516,6 +516,7 @@ public:
const ControlValue &get(unsigned int id) const;
void set(unsigned int id, const ControlValue &value);
+ void set(unsigned int id, ControlValue &&value);
const ControlInfoMap *infoMap() const { return infoMap_; }
const ControlIdMap *idMap() const { return idmap_; }
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index ae54f8c77..c22c6bdb9 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -1189,6 +1189,18 @@ void ControlList::set(unsigned int id, const ControlValue &value)
*val = value;
}
+/**
+ * \copydoc ControlList::set(unsigned int, const ControlValue &)
+ */
+void ControlList::set(unsigned int id, ControlValue &&value)
+{
+ ControlValue *val = find(id);
+ if (!val)
+ return;
+
+ *val = std::move(value);
+}
+
/**
* \fn ControlList::infoMap()
* \brief Retrieve the ControlInfoMap used to construct the ControlList
--
2.49.0
More information about the libcamera-devel
mailing list