[libcamera-devel] [PATCH 1/2] libcamera: control: define an explicit default ControlInfo constructor

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Aug 22 23:37:58 CEST 2022


Hi Christian,

Quoting Christian Rauch via libcamera-devel (2022-08-21 13:43:42)
> The default ControlInfo constructor allowed to partially initialised the
> min/max/def values. Add an explicit default constructor in order to enforce
> that either all or none of the min/max/def values are defined.
> 

I think this would break bisection, so would have to have the follow up
2/2 patch merged all in one commit.


> Signed-off-by: Christian Rauch <Rauch.Christian at gmx.de>
> ---
>  include/libcamera/controls.h | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index ebc168fc..214ad7f3 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -268,9 +268,10 @@ private:
>  class ControlInfo
>  {
>  public:
> -       explicit ControlInfo(const ControlValue &min = 0,
> -                            const ControlValue &max = 0,
> -                            const ControlValue &def = 0);
> +       explicit ControlInfo() = default;
> +       explicit ControlInfo(const ControlValue &min,
> +                            const ControlValue &max,
> +                            const ControlValue &def);

I think I agree it can be better to be explicit, but I'm weary that
skimming the next patch - some times there isn't a reasonable default.

That makes me fear we'd need to <optional> the default ... and I start
fearing how templated things might get ...

Now to the next patch...
--
Kieran

>         explicit ControlInfo(Span<const ControlValue> values,
>                              const ControlValue &def = {});
>         explicit ControlInfo(std::set<bool> values, bool def);
> --
> 2.34.1
>


More information about the libcamera-devel mailing list