[libcamera-devel,v2,3/6] libcamera: buffer: Utilise DISABLE_COPY_AND_MOVE
diff mbox series

Message ID 20210211133444.764808-4-kieran.bingham@ideasonboard.com
State Superseded
Delegated to: Kieran Bingham
Headers show
Series
  • Delete Copy-Move-Assign
Related show

Commit Message

Kieran Bingham Feb. 11, 2021, 1:34 p.m. UTC
Convert the existing copy, move and assignment operators to use the new
macros.

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

Comments

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

Thank you for the patch.

On Thu, Feb 11, 2021 at 01:34:41PM +0000, Kieran Bingham wrote:
> Convert the existing copy, move and assignment operators to use the new
> macros.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  include/libcamera/buffer.h | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
> index a26c8927d37a..d03af787cc08 100644
> --- a/include/libcamera/buffer.h
> +++ b/include/libcamera/buffer.h
> @@ -10,6 +10,7 @@
>  #include <stdint.h>
>  #include <vector>
>  
> +#include <libcamera/class.h>
>  #include <libcamera/file_descriptor.h>
>  
>  namespace libcamera {
> @@ -43,12 +44,6 @@ public:
>  
>  	FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);
>  
> -	FrameBuffer(const FrameBuffer &) = delete;
> -	FrameBuffer(FrameBuffer &&) = delete;
> -
> -	FrameBuffer &operator=(const FrameBuffer &) = delete;
> -	FrameBuffer &operator=(FrameBuffer &&) = delete;
> -
>  	const std::vector<Plane> &planes() const { return planes_; }
>  
>  	Request *request() const { return request_; }
> @@ -57,7 +52,10 @@ public:
>  
>  	unsigned int cookie() const { return cookie_; }
>  	void setCookie(unsigned int cookie) { cookie_ = cookie; }
> +
>  private:
> +	LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer);
> +
>  	friend class Request; /* Needed to update request_. */
>  	friend class V4L2VideoDevice; /* Needed to update metadata_. */
>

Patch
diff mbox series

diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
index a26c8927d37a..d03af787cc08 100644
--- a/include/libcamera/buffer.h
+++ b/include/libcamera/buffer.h
@@ -10,6 +10,7 @@ 
 #include <stdint.h>
 #include <vector>
 
+#include <libcamera/class.h>
 #include <libcamera/file_descriptor.h>
 
 namespace libcamera {
@@ -43,12 +44,6 @@  public:
 
 	FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);
 
-	FrameBuffer(const FrameBuffer &) = delete;
-	FrameBuffer(FrameBuffer &&) = delete;
-
-	FrameBuffer &operator=(const FrameBuffer &) = delete;
-	FrameBuffer &operator=(FrameBuffer &&) = delete;
-
 	const std::vector<Plane> &planes() const { return planes_; }
 
 	Request *request() const { return request_; }
@@ -57,7 +52,10 @@  public:
 
 	unsigned int cookie() const { return cookie_; }
 	void setCookie(unsigned int cookie) { cookie_ = cookie; }
+
 private:
+	LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer);
+
 	friend class Request; /* Needed to update request_. */
 	friend class V4L2VideoDevice; /* Needed to update metadata_. */