[libcamera-devel,03/10] libcamera: controls: Prevent copies of ControlId class

Message ID 20191013232755.3292-4-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Merge V4L2ControlInfoMap and ControlInfoMap
Related show

Commit Message

Laurent Pinchart Oct. 13, 2019, 11:27 p.m. UTC
Now that the V4L2ControlId embedded in V4L2ControlInfo has been moved
out and doesn't require to be copied anymore, the base ControlId class
doesn't need to be copyable either. Delete the ControlId copy
constructor and copy assignment operator.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/controls.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Niklas Söderlund Oct. 15, 2019, 12:12 a.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2019-10-14 02:27:49 +0300, Laurent Pinchart wrote:
> Now that the V4L2ControlId embedded in V4L2ControlInfo has been moved
> out and doesn't require to be copied anymore, the base ControlId class
> doesn't need to be copyable either. Delete the ControlId copy
> constructor and copy assignment operator.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  include/libcamera/controls.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index ebc4204f98fd..5534a2edb567 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -68,12 +68,11 @@ protected:
>  		: id_(id), name_(name), type_(type)
>  	{
>  	}
> -#ifndef __DOXYGEN__
> -	ControlId &operator=(const ControlId &) = default;
> -	ControlId(const ControlId &) = default;
> -#endif
>  
>  private:
> +	ControlId &operator=(const ControlId &) = delete;
> +	ControlId(const ControlId &) = delete;
> +
>  	unsigned int id_;
>  	std::string name_;
>  	ControlType type_;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Jacopo Mondi Oct. 15, 2019, 2:55 p.m. UTC | #2
Hi Laurent,

On Mon, Oct 14, 2019 at 02:27:49AM +0300, Laurent Pinchart wrote:
> Now that the V4L2ControlId embedded in V4L2ControlInfo has been moved
> out and doesn't require to be copied anymore, the base ControlId class
> doesn't need to be copyable either. Delete the ControlId copy
> constructor and copy assignment operator.

Seems good!
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/libcamera/controls.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index ebc4204f98fd..5534a2edb567 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -68,12 +68,11 @@ protected:
>  		: id_(id), name_(name), type_(type)
>  	{
>  	}
> -#ifndef __DOXYGEN__
> -	ControlId &operator=(const ControlId &) = default;
> -	ControlId(const ControlId &) = default;
> -#endif
>
>  private:
> +	ControlId &operator=(const ControlId &) = delete;
> +	ControlId(const ControlId &) = delete;
> +
>  	unsigned int id_;
>  	std::string name_;
>  	ControlType type_;
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index ebc4204f98fd..5534a2edb567 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -68,12 +68,11 @@  protected:
 		: id_(id), name_(name), type_(type)
 	{
 	}
-#ifndef __DOXYGEN__
-	ControlId &operator=(const ControlId &) = default;
-	ControlId(const ControlId &) = default;
-#endif
 
 private:
+	ControlId &operator=(const ControlId &) = delete;
+	ControlId(const ControlId &) = delete;
+
 	unsigned int id_;
 	std::string name_;
 	ControlType type_;