[libcamera-devel,v3,5/7] libcamera: controls: Utilise LIBCAMERA_DISABLE_COPY_AND_MOVE
diff mbox series

Message ID 20210212133056.873230-6-kieran.bingham@ideasonboard.com
State Accepted
Commit 83c5a2a7aa67b609bc5c14698b76b9eaee644d17
Headers show
Series
  • Delete Copy-Move-Assign
Related show

Commit Message

Kieran Bingham Feb. 12, 2021, 1:30 p.m. UTC
The ControlId and Control classes disable the copy constructor and
assignment operator, but they should also prevent move construction and
assignment.

Utilise LIBCAMERA_DISABLE_COPY_AND_MOVE to fully disable these
functions.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 include/libcamera/controls.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Laurent Pinchart Feb. 12, 2021, 2:09 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Fri, Feb 12, 2021 at 01:30:54PM +0000, Kieran Bingham wrote:
> The ControlId and Control classes disable the copy constructor and
> assignment operator, but they should also prevent move construction and
> assignment.
> 
> Utilise LIBCAMERA_DISABLE_COPY_AND_MOVE to fully disable these
> functions.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-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 3b7f3347761e..1a5690a5ccbe 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -14,6 +14,7 @@
>  #include <unordered_map>
>  #include <vector>
>  
> +#include <libcamera/class.h>
>  #include <libcamera/geometry.h>
>  #include <libcamera/span.h>
>  
> @@ -220,8 +221,7 @@ public:
>  	ControlType type() const { return type_; }
>  
>  private:
> -	ControlId &operator=(const ControlId &) = delete;
> -	ControlId(const ControlId &) = delete;
> +	LIBCAMERA_DISABLE_COPY_AND_MOVE(ControlId)
>  
>  	unsigned int id_;
>  	std::string name_;
> @@ -260,8 +260,7 @@ public:
>  	}
>  
>  private:
> -	Control(const Control &) = delete;
> -	Control &operator=(const Control &) = delete;
> +	LIBCAMERA_DISABLE_COPY_AND_MOVE(Control)
>  };
>  
>  class ControlInfo

Patch
diff mbox series

diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index 3b7f3347761e..1a5690a5ccbe 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -14,6 +14,7 @@ 
 #include <unordered_map>
 #include <vector>
 
+#include <libcamera/class.h>
 #include <libcamera/geometry.h>
 #include <libcamera/span.h>
 
@@ -220,8 +221,7 @@  public:
 	ControlType type() const { return type_; }
 
 private:
-	ControlId &operator=(const ControlId &) = delete;
-	ControlId(const ControlId &) = delete;
+	LIBCAMERA_DISABLE_COPY_AND_MOVE(ControlId)
 
 	unsigned int id_;
 	std::string name_;
@@ -260,8 +260,7 @@  public:
 	}
 
 private:
-	Control(const Control &) = delete;
-	Control &operator=(const Control &) = delete;
+	LIBCAMERA_DISABLE_COPY_AND_MOVE(Control)
 };
 
 class ControlInfo