summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-10-23 09:40:27 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-11-20 21:47:41 +0200
commitcdc68bf7f775538bcc58ff85a14cf89fc6c8668e (patch)
tree7430a549dfbf080f497299cc000fabbc75361a3a /src
parent113cfb1e0821d638b66b3fb8d85c5025b2a089c5 (diff)
libcamera: controls: Store reference to the InfoMap
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@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/controls.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index 9c6474ad..594fed84 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -597,7 +597,7 @@ void ControlInfoMap::generateIdmap()
* be used directly by application.
*/
ControlList::ControlList()
- : validator_(nullptr), idmap_(nullptr)
+ : validator_(nullptr), idmap_(nullptr), infoMap_(nullptr)
{
}
@@ -611,7 +611,7 @@ ControlList::ControlList()
* argument.
*/
ControlList::ControlList(const ControlIdMap &idmap, ControlValidator *validator)
- : validator_(validator), idmap_(&idmap)
+ : validator_(validator), idmap_(&idmap), infoMap_(nullptr)
{
}
@@ -621,7 +621,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)
{
}
@@ -771,6 +771,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);