From patchwork Thu Oct 22 13:56:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10198 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7A910C3D3C for ; Thu, 22 Oct 2020 13:56:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E8E7261439; Thu, 22 Oct 2020 15:56:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KkcerVNT"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7532960352 for ; Thu, 22 Oct 2020 15:56:09 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0396753; Thu, 22 Oct 2020 15:56:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603374969; bh=t5cjg7gJa3fAL9EhQ+AconxPBptSItlYdsl3qak1ZTI=; h=From:To:Cc:Subject:Date:From; b=KkcerVNTtq/lS6zoT/0nYKjR5ntlawKt1P2nroJH8f1KS1hfmLhhZtuMI83N+QS7c SnaSq3Rw1nOMQMWZZ/gy0cAiRpMZQMT8zfi7Ul+e73rYX1v6HGdy9wilGczgdN0eQG FeEP6Hz8/Bs3ySCPuKxjvDsiljSUXN2ZJjAci3cE= From: Kieran Bingham To: libcamera devel Date: Thu, 22 Oct 2020 14:56:00 +0100 Message-Id: <20201022135605.614240-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/5] Delete Copy-Move-Assign X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Here's a series which has been niggling me on my task list since the topic came up which highlighted that the non-copyability of the FrameBufferAllocator had been incorrectly implemented. We discussed providing a non-copyable class which could be inherited or the addition of a macro. I've chosen to go down the macro route, because I think its clearer, easier to customise, and doesn't extend the inheritance (and thus increase the size) of classes. Along the way, the following tasks have occured: - Classes which delete their copy constructor and copy assignment operator, have had those replaced by DELETE_COPY_MOVE_AND_ASSIGN. Where the existing copy/assignment deletion occured in public:, the DELETE_COPY_MOVE_AND_ASSIGN addition has been placed in private: so that Doxygen does not complain. (and it shoudl have the same effect) - The Buffer class deletes all of the copy, and move constructor and assignment operators, so this has been kept. But as the only class which goes this far, it seems to stand out on its own. I have simply converted to the new usage, I didn't want to change any functionality here. - Media objects deleted only their copy construtor. I believe this to be an oversight, as if the copy constructor is deleted, then the copy assignment operator should also be deleted. Therefore I see this macro as a win here. - MappedBuffer : This did not delete it's copy constructor, and I believe it should have - so I've added it. I have not done a thorough search of the tree to find other instances that should also delete anything yet though. I'm sure that more classes could be tightened up with the addition of these restrictions where necessary, or perhaps other variants might crop up. I'm not sure yet. Kieran Bingham (5): libcamera: Provide class.h libcamera: buffer: Utilise DELETE_COPY_MOVE_AND_ASSIGN libcamera: media_object: Utilise DELETE_COPY_AND_ASSIGN libcamera: Utilise DELETE_COPY_AND_ASSIGN libcamera: MappedBuffer: Delete copy and assignment include/libcamera/buffer.h | 10 +++--- include/libcamera/camera.h | 7 ++-- include/libcamera/camera_manager.h | 5 +-- include/libcamera/class.h | 35 +++++++++++++++++++ include/libcamera/controls.h | 7 ++-- include/libcamera/framebuffer_allocator.h | 7 ++-- include/libcamera/internal/buffer.h | 4 +++ .../libcamera/internal/byte_stream_buffer.h | 4 +-- include/libcamera/internal/camera_sensor.h | 6 ++-- include/libcamera/internal/file.h | 6 ++-- include/libcamera/internal/log.h | 6 +++- include/libcamera/internal/media_object.h | 8 +++-- include/libcamera/internal/pipeline_handler.h | 4 +-- include/libcamera/internal/v4l2_subdevice.h | 5 +-- include/libcamera/internal/v4l2_videodevice.h | 6 ++-- include/libcamera/meson.build | 1 + include/libcamera/request.h | 5 +-- 17 files changed, 87 insertions(+), 39 deletions(-) create mode 100644 include/libcamera/class.h