[libcamera-devel] [PATCH v2 09/24] libcamera: controls: Store reference to the InfoMap
Niklas Söderlund
niklas.soderlund at ragnatech.se
Mon Nov 18 18:14:28 CET 2019
Hi Jacopo,
Thanks for your work.
On 2019-11-08 22:53:54 +0200, Laurent Pinchart wrote:
> From: Jacopo Mondi <jacopo at jmondi.org>
>
> Store a reference to the ControlInfoMap used to create a ControlList and
> provide an operation to retrieve it. This will be used to implement
> serialization of ControlList.
>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> include/libcamera/controls.h | 4 ++++
> src/libcamera/controls.cpp | 16 +++++++++++++---
> 2 files changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index b35e006bc046..baca684444a7 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -232,12 +232,16 @@ public:
> const ControlValue &get(unsigned int id) const;
> void set(unsigned int id, const ControlValue &value);
>
> + const ControlInfoMap *infoMap() const { return infoMap_; }
> +
> private:
> const ControlValue *find(unsigned int id) const;
> ControlValue *find(unsigned int id);
>
> ControlValidator *validator_;
> const ControlIdMap *idmap_;
> + const ControlInfoMap *infoMap_;
> +
> ControlListMap controls_;
> };
>
> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
> index 178ce3d99bce..eae0250a92e3 100644
> --- a/src/libcamera/controls.cpp
> +++ b/src/libcamera/controls.cpp
> @@ -595,7 +595,7 @@ void ControlInfoMap::generateIdmap()
> * be used directly by application.
> */
> ControlList::ControlList()
> - : validator_(nullptr), idmap_(nullptr)
> + : validator_(nullptr), idmap_(nullptr), infoMap_(nullptr)
> {
> }
>
> @@ -609,7 +609,7 @@ ControlList::ControlList()
> * argument.
> */
> ControlList::ControlList(const ControlIdMap &idmap, ControlValidator *validator)
> - : validator_(validator), idmap_(&idmap)
> + : validator_(validator), idmap_(&idmap), infoMap_(nullptr)
> {
> }
>
> @@ -619,7 +619,7 @@ ControlList::ControlList(const ControlIdMap &idmap, ControlValidator *validator)
> * \param[in] validator The validator (may be null)
> */
> ControlList::ControlList(const ControlInfoMap &info, ControlValidator *validator)
> - : validator_(validator), idmap_(&info.idmap())
> + : validator_(validator), idmap_(&info.idmap()), infoMap_(&info)
> {
> }
>
> @@ -769,6 +769,16 @@ void ControlList::set(unsigned int id, const ControlValue &value)
> *val = value;
> }
>
> +/**
> + * \fn ControlList::infoMap()
> + * \brief Retrieve the ControlInfoMap used to construct the ControlList
> + *
> + * \return The ControlInfoMap used to construct the ControlList. ControlList
> + * instances constructed with ControlList() or
> + * ControlList(const ControlIdMap &idmap, ControlValidator *validator) have no
> + * associated ControlInfoMap, nullptr is returned in that case.
> + */
> +
> const ControlValue *ControlList::find(unsigned int id) const
> {
> const auto iter = controls_.find(id);
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list