[libcamera-devel] [PATCH v2 06/24] libcamera: controls: Add move constructor to ControlInfoMap

Kieran Bingham kieran.bingham at ideasonboard.com
Tue Nov 19 16:58:36 CET 2019


Hi Laurent,

On 08/11/2019 20:53, Laurent Pinchart wrote:
> The ControlInfoMap class has a move assignment operator from a plain
> map, but on corresponding move constructor. Add one.

That sentence doesn't seem to quite make sense. Could you try to
refactor it a little please?

In fact, I think it's just an 's/on/no/' :-D


> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Otherwise seems fine, with Jacopo's note.

Reviewed-by: Kieran Bingham <kieran.bingham 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
--
Kieran


More information about the libcamera-devel mailing list