[libcamera-devel] [PATCH v2 4/6] libcamera: media_object: Utilise LIBCAMERA_DISABLE_COPY
Kieran Bingham
kieran.bingham at ideasonboard.com
Thu Feb 11 14:34:42 CET 2021
Convert MediaLink, MediaPad, and MediaEntity to declare
LIBCAMERA_DISABLE_COPY. These classes already deleted their copy
constructor but not the assignment operator.
Utilising the LIBCAMERA_DISABLE_COPY fully prevents all copying of
these classes.
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
include/libcamera/internal/media_object.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h
index 2b336961f98d..058f5b413837 100644
--- a/include/libcamera/internal/media_object.h
+++ b/include/libcamera/internal/media_object.h
@@ -12,6 +12,8 @@
#include <linux/media.h>
+#include <libcamera/class.h>
+
namespace libcamera {
class MediaDevice;
@@ -47,11 +49,12 @@ public:
int setEnabled(bool enable);
private:
+ LIBCAMERA_DISABLE_COPY(MediaLink);
+
friend class MediaDevice;
MediaLink(const struct media_v2_link *link,
MediaPad *source, MediaPad *sink);
- MediaLink(const MediaLink &) = delete;
MediaPad *source_;
MediaPad *sink_;
@@ -72,7 +75,7 @@ private:
friend class MediaDevice;
MediaPad(const struct media_v2_pad *pad, MediaEntity *entity);
- MediaPad(const MediaPad &) = delete;
+ LIBCAMERA_DISABLE_COPY(MediaPad);
unsigned int index_;
MediaEntity *entity_;
@@ -103,7 +106,7 @@ private:
MediaEntity(MediaDevice *dev, const struct media_v2_entity *entity,
unsigned int major = 0, unsigned int minor = 0);
- MediaEntity(const MediaEntity &) = delete;
+ LIBCAMERA_DISABLE_COPY(MediaEntity);
void addPad(MediaPad *pad);
--
2.25.1
More information about the libcamera-devel
mailing list