[libcamera-devel,4/9] libcamera: controls: Make ControlList::find() protected

Message ID 20191007224642.6597-5-laurent.pinchart@ideasonboard.com
State Superseded
Headers show
Series
  • Use ControlList for both libcamera and V4L2 controls
Related show

Commit Message

Laurent Pinchart Oct. 7, 2019, 10:46 p.m. UTC
To prepare for

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/controls.h |  3 ++-
 src/libcamera/controls.cpp   | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

Comments

Jacopo Mondi Oct. 9, 2019, 8:21 a.m. UTC | #1
Hi Laurent,

On Tue, Oct 08, 2019 at 01:46:37AM +0300, Laurent Pinchart wrote:
> To prepare for
>
prepare for what ? :)

With this fixed
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/libcamera/controls.h |  3 ++-
>  src/libcamera/controls.cpp   | 14 ++++++++++++++
>  2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index a5a6a135ec16..fc33f0762138 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -159,10 +159,11 @@ public:
>  	const ControlValue &get(const ControlId &id) const;
>  	void set(const ControlId &id, const ControlValue &value);
>
> -private:
> +protected:
>  	const ControlValue *find(const ControlId &id) const;
>  	ControlValue *find(const ControlId &id);
>
> +private:
>  	ControlValidator *validator_;
>  	ControlListMap controls_;
>  };
> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
> index e528dd80a2a7..afea09d6d7d7 100644
> --- a/src/libcamera/controls.cpp
> +++ b/src/libcamera/controls.cpp
> @@ -515,6 +515,13 @@ void ControlList::set(const ControlId &id, const ControlValue &value)
>  	*val = value;
>  }
>
> +/**
> + * \brief Find a control in the list
> + * \param[in] id The control ID
> + *
> + * \return The control value for the control \a id, or nullptr if no such
> + * control exists in the list
> + */
>  const ControlValue *ControlList::find(const ControlId &id) const
>  {
>  	const auto iter = controls_.find(&id);
> @@ -528,6 +535,13 @@ const ControlValue *ControlList::find(const ControlId &id) const
>  	return &iter->second;
>  }
>
> +/**
> + * \brief Find a control in the list
> + * \param[in] id The control ID
> + *
> + * \return The control value for the control \a id, or nullptr if no such
> + * control exists in the list
> + */
>  ControlValue *ControlList::find(const ControlId &id)
>  {
>  	if (validator_ && !validator_->validate(id)) {
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Oct. 9, 2019, 9:10 a.m. UTC | #2
Hi Jacopo,

On Wed, Oct 09, 2019 at 10:21:27AM +0200, Jacopo Mondi wrote:
> On Tue, Oct 08, 2019 at 01:46:37AM +0300, Laurent Pinchart wrote:
> > To prepare for
>
> prepare for what ? :)

We should be prepared for everything ;-)

Actually this patch isn't needed, I'll drop it.

> With this fixed
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  include/libcamera/controls.h |  3 ++-
> >  src/libcamera/controls.cpp   | 14 ++++++++++++++
> >  2 files changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> > index a5a6a135ec16..fc33f0762138 100644
> > --- a/include/libcamera/controls.h
> > +++ b/include/libcamera/controls.h
> > @@ -159,10 +159,11 @@ public:
> >  	const ControlValue &get(const ControlId &id) const;
> >  	void set(const ControlId &id, const ControlValue &value);
> >
> > -private:
> > +protected:
> >  	const ControlValue *find(const ControlId &id) const;
> >  	ControlValue *find(const ControlId &id);
> >
> > +private:
> >  	ControlValidator *validator_;
> >  	ControlListMap controls_;
> >  };
> > diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
> > index e528dd80a2a7..afea09d6d7d7 100644
> > --- a/src/libcamera/controls.cpp
> > +++ b/src/libcamera/controls.cpp
> > @@ -515,6 +515,13 @@ void ControlList::set(const ControlId &id, const ControlValue &value)
> >  	*val = value;
> >  }
> >
> > +/**
> > + * \brief Find a control in the list
> > + * \param[in] id The control ID
> > + *
> > + * \return The control value for the control \a id, or nullptr if no such
> > + * control exists in the list
> > + */
> >  const ControlValue *ControlList::find(const ControlId &id) const
> >  {
> >  	const auto iter = controls_.find(&id);
> > @@ -528,6 +535,13 @@ const ControlValue *ControlList::find(const ControlId &id) const
> >  	return &iter->second;
> >  }
> >
> > +/**
> > + * \brief Find a control in the list
> > + * \param[in] id The control ID
> > + *
> > + * \return The control value for the control \a id, or nullptr if no such
> > + * control exists in the list
> > + */
> >  ControlValue *ControlList::find(const ControlId &id)
> >  {
> >  	if (validator_ && !validator_->validate(id)) {

Patch

diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index a5a6a135ec16..fc33f0762138 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -159,10 +159,11 @@  public:
 	const ControlValue &get(const ControlId &id) const;
 	void set(const ControlId &id, const ControlValue &value);
 
-private:
+protected:
 	const ControlValue *find(const ControlId &id) const;
 	ControlValue *find(const ControlId &id);
 
+private:
 	ControlValidator *validator_;
 	ControlListMap controls_;
 };
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index e528dd80a2a7..afea09d6d7d7 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -515,6 +515,13 @@  void ControlList::set(const ControlId &id, const ControlValue &value)
 	*val = value;
 }
 
+/**
+ * \brief Find a control in the list
+ * \param[in] id The control ID
+ *
+ * \return The control value for the control \a id, or nullptr if no such
+ * control exists in the list
+ */
 const ControlValue *ControlList::find(const ControlId &id) const
 {
 	const auto iter = controls_.find(&id);
@@ -528,6 +535,13 @@  const ControlValue *ControlList::find(const ControlId &id) const
 	return &iter->second;
 }
 
+/**
+ * \brief Find a control in the list
+ * \param[in] id The control ID
+ *
+ * \return The control value for the control \a id, or nullptr if no such
+ * control exists in the list
+ */
 ControlValue *ControlList::find(const ControlId &id)
 {
 	if (validator_ && !validator_->validate(id)) {