[libcamera-devel] [PATCH v2 06/24] libcamera: controls: Add move constructor to ControlInfoMap
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Nov 8 21:53:51 CET 2019
The ControlInfoMap class has a move assignment operator from a plain
map, but on corresponding move constructor. Add one.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
include/libcamera/controls.h | 1 +
src/libcamera/controls.cpp | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index f9979a466eaa..548c06c65bb6 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -146,6 +146,7 @@ public:
ControlInfoMap() = default;
ControlInfoMap(const ControlInfoMap &other) = default;
ControlInfoMap(std::initializer_list<Map::value_type> init);
+ ControlInfoMap(Map &&info);
ControlInfoMap &operator=(const ControlInfoMap &other) = default;
ControlInfoMap &operator=(std::initializer_list<Map::value_type> init);
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index 021d5f0990e0..ae6ca2a7cf7e 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -445,6 +445,19 @@ ControlInfoMap::ControlInfoMap(std::initializer_list<Map::value_type> init)
generateIdmap();
}
+/**
+ * \brief Construct a ControlInfoMap from a plain map
+ * \param[in] info The control info plain map
+ *
+ * Construct a new ControlInfoMap and populate its contents with those of
+ * \a info using move semantics. Upon return the \a info map will be empty.
+ */
+ControlInfoMap::ControlInfoMap(Map &&info)
+ : Map(std::move(info))
+{
+ generateIdmap();
+}
+
/**
* \fn ControlInfoMap &ControlInfoMap::operator=(const ControlInfoMap &other)
* \brief Copy assignment operator, replace the contents with a copy of \a other
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list