From patchwork Thu Oct 22 13:56:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10199 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 939B2C3D3C for ; Thu, 22 Oct 2020 13:56:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 543BE61462; Thu, 22 Oct 2020 15:56:11 +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="NO6Hv9DR"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 19701610B6 for ; Thu, 22 Oct 2020 15:56:10 +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 79A22A43; Thu, 22 Oct 2020 15:56:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603374969; bh=/UwFBQMbTYwsBkPVdG7FRyJUA21BDFfVyGH/w41K6hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NO6Hv9DR83Vi0rgcFZNerLil9ncFRxKxR177adAQV8AxnJQ69wi14V48sV2+DrGrR H5LFFKLT7iqoYwVdWu3zeblpLgHkODl+dbE4ZdcAQiOZfsJzkBAifNDgOOIUx5/2+f bArW4ysWSLJx3lT4I/VMAtzNzPeNndAtdbv8dbck= From: Kieran Bingham To: libcamera devel Date: Thu, 22 Oct 2020 14:56:01 +0100 Message-Id: <20201022135605.614240-2-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 1/5] libcamera: Provide class.h 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" Provide a public header to define helpers for class definitions. This initially implements macros to clearly define the deletion of copy/move/assignment constructors/operators for classes to restrict their capabilities explicitly. Signed-off-by: Kieran Bingham --- include/libcamera/class.h | 35 +++++++++++++++++++++++++++++++++++ include/libcamera/meson.build | 1 + 2 files changed, 36 insertions(+) create mode 100644 include/libcamera/class.h diff --git a/include/libcamera/class.h b/include/libcamera/class.h new file mode 100644 index 000000000000..adcfa8860957 --- /dev/null +++ b/include/libcamera/class.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2020, Google Inc. + * + * class.h - class helpers + */ +#ifndef __LIBCAMERA_CLASS_H__ +#define __LIBCAMERA_CLASS_H__ + +/** + * \brief Delete the copy constructor and assignment operator. + */ +#define DELETE_COPY_AND_ASSIGN(klass) \ + /* copy constructor. */ \ + klass(const klass &) = delete; \ + /* copy assignment operator. */ \ + klass &operator=(const klass &) = delete + +/** + * \brief Delete the move construtor and assignment operator. + */ +#define DELETE_MOVE_AND_ASSIGN(klass) \ + /* move constructor. */ \ + klass(klass &&) = delete; \ + /* move assignment operator. */ \ + klass &operator=(klass &&) = delete + +/** + * \brief Delete all copy and move constructors, and assignment operators. + */ +#define DELETE_COPY_MOVE_AND_ASSIGN(klass) \ + DELETE_COPY_AND_ASSIGN(klass); \ + DELETE_MOVE_AND_ASSIGN(klass) + +#endif /* __LIBCAMERA_CLASS_H__ */ diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 3d5fc70134ad..b3363a6f735b 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -5,6 +5,7 @@ libcamera_public_headers = files([ 'buffer.h', 'camera.h', 'camera_manager.h', + 'class.h', 'controls.h', 'event_dispatcher.h', 'event_notifier.h',