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>
This commit is contained in:
Laurent Pinchart 2019-10-24 01:05:37 +03:00
parent e89c2b2295
commit 6d492c2d75
2 changed files with 14 additions and 0 deletions

View file

@ -147,6 +147,7 @@ public:
ControlInfoMap() = default; ControlInfoMap() = default;
ControlInfoMap(const ControlInfoMap &other) = default; ControlInfoMap(const ControlInfoMap &other) = default;
ControlInfoMap(std::initializer_list<Map::value_type> init); ControlInfoMap(std::initializer_list<Map::value_type> init);
ControlInfoMap(Map &&info);
ControlInfoMap &operator=(const ControlInfoMap &other) = default; ControlInfoMap &operator=(const ControlInfoMap &other) = default;
ControlInfoMap &operator=(std::initializer_list<Map::value_type> init); ControlInfoMap &operator=(std::initializer_list<Map::value_type> init);

View file

@ -446,6 +446,19 @@ ControlInfoMap::ControlInfoMap(std::initializer_list<Map::value_type> init)
generateIdmap(); 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) * \fn ControlInfoMap &ControlInfoMap::operator=(const ControlInfoMap &other)
* \brief Copy assignment operator, replace the contents with a copy of \a other * \brief Copy assignment operator, replace the contents with a copy of \a other