Patch Detail
Show a patch.
GET /api/patches/10202/?format=api
{ "id": 10202, "url": "https://patchwork.libcamera.org/api/patches/10202/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10202/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20201022135605.614240-5-kieran.bingham@ideasonboard.com>", "date": "2020-10-22T13:56:04", "name": "[libcamera-devel,4/5] libcamera: Utilise DELETE_COPY_AND_ASSIGN", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "cdd45fbf094ab3066acc4a8af6889bed2a4f01ff", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": { "id": 11, "url": "https://patchwork.libcamera.org/api/users/11/?format=api", "username": "kbingham", "first_name": "Kieran", "last_name": "Bingham", "email": "kieran.bingham@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/10202/mbox/", "series": [ { "id": 1404, "url": "https://patchwork.libcamera.org/api/series/1404/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1404", "date": "2020-10-22T13:56:00", "name": "Delete Copy-Move-Assign", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1404/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10202/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10202/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AE05EC3D3C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Oct 2020 13:56:15 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 729D861439;\n\tThu, 22 Oct 2020 15:56:15 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 823D56146A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 15:56:11 +0200 (CEST)", "from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1651B53;\n\tThu, 22 Oct 2020 15:56:11 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"rG+ZDUt0\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603374971;\n\tbh=Zz3yu6VewXM5fdkFPkTDlG8Vh7jM7o2ceWV9WyieKSo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=rG+ZDUt0JJNhMljwdD185lQDpCWo1Zfkieh4aLbtUOcJs8apczIr7Pg0WB7UnKXUL\n\t3WCWlKgwoAFIknXcSSwdlnD/rRvEiqcOgTXLRoz0tL2Mmk6e+jlCnEJmnV14rCFMp0\n\tNLZhZ0p2IDp0rFKtl3GbiAYFv5sKtbpiBZjz9YVs=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Thu, 22 Oct 2020 14:56:04 +0100", "Message-Id": "<20201022135605.614240-5-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20201022135605.614240-1-kieran.bingham@ideasonboard.com>", "References": "<20201022135605.614240-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 4/5] libcamera: Utilise\n\tDELETE_COPY_AND_ASSIGN", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Replace existing use cases where the copy constructor and copy assignment operator\nare deleted with the DELETE_COPY_AND_ASSIGN statement\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/camera.h | 7 ++++---\n include/libcamera/camera_manager.h | 5 +++--\n include/libcamera/controls.h | 7 +++----\n include/libcamera/framebuffer_allocator.h | 7 ++++---\n include/libcamera/internal/byte_stream_buffer.h | 4 ++--\n include/libcamera/internal/camera_sensor.h | 6 +++---\n include/libcamera/internal/file.h | 6 +++---\n include/libcamera/internal/log.h | 6 +++++-\n include/libcamera/internal/pipeline_handler.h | 4 ++--\n include/libcamera/internal/v4l2_subdevice.h | 5 +++--\n include/libcamera/internal/v4l2_videodevice.h | 6 +++---\n include/libcamera/request.h | 5 +++--\n 12 files changed, 38 insertions(+), 30 deletions(-)", "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 79ff8d6b67a4..a9b855bb4691 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -12,6 +12,7 @@\n #include <stdint.h>\n #include <string>\n \n+#include <libcamera/class.h>\n #include <libcamera/controls.h>\n #include <libcamera/object.h>\n #include <libcamera/request.h>\n@@ -77,9 +78,6 @@ public:\n \t\t\t\t\t const std::string &id,\n \t\t\t\t\t const std::set<Stream *> &streams);\n \n-\tCamera(const Camera &) = delete;\n-\tCamera &operator=(const Camera &) = delete;\n-\n \tconst std::string &id() const;\n \n \tSignal<Request *, FrameBuffer *> bufferCompleted;\n@@ -105,6 +103,9 @@ public:\n private:\n \tCamera(PipelineHandler *pipe, const std::string &id,\n \t const std::set<Stream *> &streams);\n+\n+\tDELETE_COPY_AND_ASSIGN(Camera);\n+\n \t~Camera();\n \n \tclass Private;\ndiff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h\nindex 9eb2b6f5a5f5..1442c4701432 100644\n--- a/include/libcamera/camera_manager.h\n+++ b/include/libcamera/camera_manager.h\n@@ -12,6 +12,7 @@\n #include <sys/types.h>\n #include <vector>\n \n+#include <libcamera/class.h>\n #include <libcamera/object.h>\n #include <libcamera/signal.h>\n \n@@ -24,8 +25,6 @@ class CameraManager : public Object\n {\n public:\n \tCameraManager();\n-\tCameraManager(const CameraManager &) = delete;\n-\tCameraManager &operator=(const CameraManager &) = delete;\n \t~CameraManager();\n \n \tint start();\n@@ -48,6 +47,8 @@ public:\n \tSignal<std::shared_ptr<Camera>> cameraRemoved;\n \n private:\n+\tDELETE_COPY_AND_ASSIGN(CameraManager);\n+\n \tstatic const std::string version_;\n \tstatic CameraManager *self_;\n \ndiff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 80944efc133a..8a84170a0293 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -13,6 +13,7 @@\n #include <string>\n #include <unordered_map>\n \n+#include <libcamera/class.h>\n #include <libcamera/geometry.h>\n #include <libcamera/span.h>\n \n@@ -218,8 +219,7 @@ public:\n \tControlType type() const { return type_; }\n \n private:\n-\tControlId &operator=(const ControlId &) = delete;\n-\tControlId(const ControlId &) = delete;\n+\tDELETE_COPY_AND_ASSIGN(ControlId);\n \n \tunsigned int id_;\n \tstd::string name_;\n@@ -258,8 +258,7 @@ public:\n \t}\n \n private:\n-\tControl(const Control &) = delete;\n-\tControl &operator=(const Control &) = delete;\n+\tDELETE_COPY_AND_ASSIGN(Control);\n };\n \n class ControlInfo\ndiff --git a/include/libcamera/framebuffer_allocator.h b/include/libcamera/framebuffer_allocator.h\nindex a96aaeae58ce..5c540f23f8d9 100644\n--- a/include/libcamera/framebuffer_allocator.h\n+++ b/include/libcamera/framebuffer_allocator.h\n@@ -11,6 +11,8 @@\n #include <memory>\n #include <vector>\n \n+#include <libcamera/class.h>\n+\n namespace libcamera {\n \n class Camera;\n@@ -21,9 +23,6 @@ class FrameBufferAllocator\n {\n public:\n \tFrameBufferAllocator(std::shared_ptr<Camera> camera);\n-\tFrameBufferAllocator(const FrameBufferAllocator &) = delete;\n-\tFrameBufferAllocator &operator=(const FrameBufferAllocator &) = delete;\n-\n \t~FrameBufferAllocator();\n \n \tint allocate(Stream *stream);\n@@ -33,6 +32,8 @@ public:\n \tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers(Stream *stream) const;\n \n private:\n+\tDELETE_COPY_AND_ASSIGN(FrameBufferAllocator);\n+\n \tstd::shared_ptr<Camera> camera_;\n \tstd::map<Stream *, std::vector<std::unique_ptr<FrameBuffer>>> buffers_;\n };\ndiff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h\nindex db59577dc332..b38c026c8eeb 100644\n--- a/include/libcamera/internal/byte_stream_buffer.h\n+++ b/include/libcamera/internal/byte_stream_buffer.h\n@@ -11,6 +11,7 @@\n #include <stdint.h>\n #include <type_traits>\n \n+#include <libcamera/class.h>\n #include <libcamera/span.h>\n \n namespace libcamera {\n@@ -65,8 +66,7 @@ public:\n \t}\n \n private:\n-\tByteStreamBuffer(const ByteStreamBuffer &other) = delete;\n-\tByteStreamBuffer &operator=(const ByteStreamBuffer &other) = delete;\n+\tDELETE_COPY_AND_ASSIGN(ByteStreamBuffer);\n \n \tvoid setOverflow();\n \ndiff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex b9eba89f00fb..f03791847af2 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -11,6 +11,7 @@\n #include <string>\n #include <vector>\n \n+#include <libcamera/class.h>\n #include <libcamera/controls.h>\n #include <libcamera/geometry.h>\n \n@@ -41,9 +42,6 @@ public:\n \texplicit CameraSensor(const MediaEntity *entity);\n \t~CameraSensor();\n \n-\tCameraSensor(const CameraSensor &) = delete;\n-\tCameraSensor &operator=(const CameraSensor &) = delete;\n-\n \tint init();\n \n \tconst std::string &model() const { return model_; }\n@@ -68,6 +66,8 @@ protected:\n \tstd::string logPrefix() const override;\n \n private:\n+\tDELETE_COPY_AND_ASSIGN(CameraSensor);\n+\n \tint generateId();\n \n \tconst MediaEntity *entity_;\ndiff --git a/include/libcamera/internal/file.h b/include/libcamera/internal/file.h\nindex 9b6d011f5e9d..00f8d49d3882 100644\n--- a/include/libcamera/internal/file.h\n+++ b/include/libcamera/internal/file.h\n@@ -11,6 +11,7 @@\n #include <string>\n #include <sys/types.h>\n \n+#include <libcamera/class.h>\n #include <libcamera/span.h>\n \n namespace libcamera {\n@@ -34,9 +35,6 @@ public:\n \tFile();\n \t~File();\n \n-\tFile(const File &) = delete;\n-\tFile &operator=(const File &) = delete;\n-\n \tconst std::string &fileName() const { return name_; }\n \tvoid setFileName(const std::string &name);\n \tbool exists() const;\n@@ -62,6 +60,8 @@ public:\n \tstatic bool exists(const std::string &name);\n \n private:\n+\tDELETE_COPY_AND_ASSIGN(File);\n+\n \tvoid unmapAll();\n \n \tstd::string name_;\ndiff --git a/include/libcamera/internal/log.h b/include/libcamera/internal/log.h\nindex 4b10087a4718..9e312b6605d3 100644\n--- a/include/libcamera/internal/log.h\n+++ b/include/libcamera/internal/log.h\n@@ -10,6 +10,8 @@\n #include <chrono>\n #include <sstream>\n \n+#include <libcamera/class.h>\n+\n #include \"libcamera/internal/utils.h\"\n \n namespace libcamera {\n@@ -57,7 +59,7 @@ public:\n \t\t LogSeverity severity);\n \tLogMessage(const char *fileName, unsigned int line,\n \t\t const LogCategory &category, LogSeverity severity);\n-\tLogMessage(const LogMessage &) = delete;\n+\n \tLogMessage(LogMessage &&);\n \t~LogMessage();\n \n@@ -70,6 +72,8 @@ public:\n \tconst std::string msg() const { return msgStream_.str(); }\n \n private:\n+\tDELETE_COPY_AND_ASSIGN(LogMessage);\n+\n \tvoid init(const char *fileName, unsigned int line);\n \n \tstd::ostringstream msgStream_;\ndiff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\nindex a4e1b529c461..11a57e2f63c6 100644\n--- a/include/libcamera/internal/pipeline_handler.h\n+++ b/include/libcamera/internal/pipeline_handler.h\n@@ -15,6 +15,7 @@\n #include <sys/types.h>\n #include <vector>\n \n+#include <libcamera/class.h>\n #include <libcamera/controls.h>\n #include <libcamera/object.h>\n #include <libcamera/stream.h>\n@@ -50,8 +51,7 @@ public:\n \tstd::unique_ptr<IPAProxy> ipa_;\n \n private:\n-\tCameraData(const CameraData &) = delete;\n-\tCameraData &operator=(const CameraData &) = delete;\n+\tDELETE_COPY_AND_ASSIGN(CameraData);\n };\n \n class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>,\ndiff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex 02ee3e914a8b..28abb9299ce9 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -10,6 +10,7 @@\n #include <string>\n #include <vector>\n \n+#include <libcamera/class.h>\n #include <libcamera/geometry.h>\n \n #include \"libcamera/internal/formats.h\"\n@@ -40,8 +41,6 @@ public:\n \t};\n \n \texplicit V4L2Subdevice(const MediaEntity *entity);\n-\tV4L2Subdevice(const V4L2Subdevice &) = delete;\n-\tV4L2Subdevice &operator=(const V4L2Subdevice &) = delete;\n \t~V4L2Subdevice();\n \n \tint open();\n@@ -67,6 +66,8 @@ protected:\n \tstd::string logPrefix() const override;\n \n private:\n+\tDELETE_COPY_AND_ASSIGN(V4L2Subdevice);\n+\n \tstd::vector<unsigned int> enumPadCodes(unsigned int pad);\n \tstd::vector<SizeRange> enumPadSizes(unsigned int pad,\n \t\t\t\t\t unsigned int code);\ndiff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex 53f6a2d5515b..40d6499fce75 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -16,6 +16,7 @@\n #include <linux/videodev2.h>\n \n #include <libcamera/buffer.h>\n+#include <libcamera/class.h>\n #include <libcamera/geometry.h>\n #include <libcamera/pixel_format.h>\n #include <libcamera/signal.h>\n@@ -172,11 +173,8 @@ public:\n \n \texplicit V4L2VideoDevice(const std::string &deviceNode);\n \texplicit V4L2VideoDevice(const MediaEntity *entity);\n-\tV4L2VideoDevice(const V4L2VideoDevice &) = delete;\n \t~V4L2VideoDevice();\n \n-\tV4L2VideoDevice &operator=(const V4L2VideoDevice &) = delete;\n-\n \tint open();\n \tint open(int handle, enum v4l2_buf_type type);\n \tvoid close();\n@@ -219,6 +217,8 @@ protected:\n \tstd::string logPrefix() const override;\n \n private:\n+\tDELETE_COPY_AND_ASSIGN(V4L2VideoDevice);\n+\n \tint getFormatMeta(V4L2DeviceFormat *format);\n \tint trySetFormatMeta(V4L2DeviceFormat *format, bool set);\n \ndiff --git a/include/libcamera/request.h b/include/libcamera/request.h\nindex 655b1324bae8..4a34ecddc16a 100644\n--- a/include/libcamera/request.h\n+++ b/include/libcamera/request.h\n@@ -12,6 +12,7 @@\n #include <stdint.h>\n #include <unordered_set>\n \n+#include <libcamera/class.h>\n #include <libcamera/controls.h>\n #include <libcamera/signal.h>\n \n@@ -39,8 +40,6 @@ public:\n \tusing BufferMap = std::map<const Stream *, FrameBuffer *>;\n \n \tRequest(Camera *camera, uint64_t cookie = 0);\n-\tRequest(const Request &) = delete;\n-\tRequest &operator=(const Request &) = delete;\n \t~Request();\n \n \tvoid reuse(ReuseFlag flags = Default);\n@@ -57,6 +56,8 @@ public:\n \tbool hasPendingBuffers() const { return !pending_.empty(); }\n \n private:\n+\tDELETE_COPY_AND_ASSIGN(Request);\n+\n \tfriend class PipelineHandler;\n \n \tvoid complete();\n", "prefixes": [ "libcamera-devel", "4/5" ] }