From 0adc13ff7626a12b227d30313b64ffb99a977531 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 30 Jun 2019 20:48:05 +0300 Subject: libcamera: controls: Extend ControlList to access controls by ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ControlList class implements a map from control specifier to control ID. To avoid constant lookups of ControlInfo when using the class in the libcamera core or in pipeline handlers, the map uses ControlInfo pointers instead of ControlId values. This is however not very convenient for applications or pipeline handlers, as they would be forced to first look up the ControlInfo pointers for the controls they want to access. Facilitate ease of use of ControlLists by implementing an internal lookup of the ControlInfo from the controls provided by the Camera. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- include/libcamera/controls.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 18293c94..fbb3a622 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -117,11 +117,13 @@ public: const_iterator begin() const { return controls_.begin(); } const_iterator end() const { return controls_.end(); } + bool contains(ControlId id) const; bool contains(const ControlInfo *info) const; bool empty() const { return controls_.empty(); } std::size_t size() const { return controls_.size(); } void clear() { controls_.clear(); } + ControlValue &operator[](ControlId id); ControlValue &operator[](const ControlInfo *info) { return controls_[info]; } void update(const ControlList &list); -- cgit v1.2.1