From 6d492c2d758f7ab958f9d4afe1b157b59bb41c34 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 24 Oct 2019 01:05:37 +0300 Subject: libcamera: controls: Add move constructor to ControlInfoMap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ControlInfoMap class has a move assignment operator from a plain map, but no corresponding move constructor. Add one. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Kieran Bingham --- 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 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 init); + ControlInfoMap(Map &&info); ControlInfoMap &operator=(const ControlInfoMap &other) = default; ControlInfoMap &operator=(std::initializer_list 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 @@ -446,6 +446,19 @@ ControlInfoMap::ControlInfoMap(std::initializer_list 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 -- cgit v1.2.1