summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-24 01:05:37 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-11-20 21:47:35 +0200
commit6d492c2d758f7ab958f9d4afe1b157b59bb41c34 (patch)
tree798cd7d27fe31451b725db03319d60baf9fcde70
parente89c2b22957b9faa2d9521dd8d696ed1cefc7dda (diff)
libcamera: controls: Add move constructor to ControlInfoMap
The ControlInfoMap class has a move assignment operator from a plain map, but no corresponding move constructor. Add one. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--include/libcamera/controls.h1
-rw-r--r--src/libcamera/controls.cpp13
2 files changed, 14 insertions, 0 deletions
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index 1ecc8fcb..1468326d 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -147,6 +147,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 a6223b82..50f37c6b 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -447,6 +447,19 @@ ControlInfoMap::ControlInfoMap(std::initializer_list<Map::value_type> init)
}
/**
+ * \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
* \param[in] other The other ControlInfoMap