Patch Detail
Show a patch.
GET /api/1.1/patches/12894/?format=api
{ "id": 12894, "url": "https://patchwork.libcamera.org/api/1.1/patches/12894/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12894/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210711170359.300-2-laurent.pinchart@ideasonboard.com>", "date": "2021-07-11T17:03:57", "name": "[libcamera-devel,v2,1/3] libcamera: base: class: Expose Extensible private data to other classes", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "c80fab26d1c7058b88b9f61d318db7a10fb6f6cd", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/12894/mbox/", "series": [ { "id": 2225, "url": "https://patchwork.libcamera.org/api/1.1/series/2225/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2225", "date": "2021-07-11T17:03:56", "name": "libcamera: Make Framebuffer class Extensible", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2225/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12894/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12894/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 3DC2FC3225\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 11 Jul 2021 17:04:52 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 60C2868521;\n\tSun, 11 Jul 2021 19:04:51 +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 120486851B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 11 Jul 2021 19:04:49 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9BA4F255\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 11 Jul 2021 19:04:48 +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=\"iLHoS+Mw\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1626023088;\n\tbh=Z7K9NPx1ABJVzh27zZgvw/0OrteuDBPTsu+nL5gx+Ds=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=iLHoS+Mwk1fLbB1zR/4BOR5ugr9DkJH2hnFXfU+e5UvU4GsgvIxiwVZ3QryOr+d1B\n\tppJTbJUzmAi/P753XXrOiHlTDh7uBN9cIirN8aoxRAWJfyhBuIvVr6YCEP+Ti/LkyQ\n\tfDiOOglorGvUlUuMNvDv2eOk3uYKlj8lk6vPao9s=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 11 Jul 2021 20:03:57 +0300", "Message-Id": "<20210711170359.300-2-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210711170359.300-1-laurent.pinchart@ideasonboard.com>", "References": "<20210711170359.300-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 1/3] libcamera: base: class: Expose\n\tExtensible private data to other classes", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Despite sharing the same name, the private data class created by the\nExtensible design pattern and the C++ private access specifier have\ndifferent goals. The latter specifies class members private to the\nclass, while the former stores data not visible to the application.\n\nThere are use cases for accessing the private data class from other\nclasses inside libcamera. Make this possible by exposing public _d()\nfunctions in the class deriving from Extensible. This won't allow access\nto the private data by applications as the definition of the Private\nclass isn't visible outside of libcamera.\n\nThe _d() functions need to be defined as template functions to delay\ntheir evaluation, as the static_cast() operator in the Extensible::_d()\nfunctions needs the Private class to be fully defined.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/base/class.h | 14 ++++++++++++--\n 1 file changed, 12 insertions(+), 2 deletions(-)", "diff": "diff --git a/include/libcamera/base/class.h b/include/libcamera/base/class.h\nindex a07dac057331..8212c3d4a5ae 100644\n--- a/include/libcamera/base/class.h\n+++ b/include/libcamera/base/class.h\n@@ -33,14 +33,24 @@ namespace libcamera {\n #define LIBCAMERA_DECLARE_PRIVATE()\t\t\t\t\t\\\n public:\t\t\t\t\t\t\t\t\t\\\n \tclass Private;\t\t\t\t\t\t\t\\\n-\tfriend class Private;\n+\tfriend class Private;\t\t\t\t\t\t\\\n+\ttemplate <bool B = true>\t\t\t\t\t\\\n+\tconst Private *_d() const\t\t\t\t\t\\\n+\t{\t\t\t\t\t\t\t\t\\\n+\t\treturn Extensible::_d<Private>();\t\t\t\\\n+\t}\t\t\t\t\t\t\t\t\\\n+\ttemplate <bool B = true>\t\t\t\t\t\\\n+\tPrivate *_d()\t\t\t\t\t\t\t\\\n+\t{\t\t\t\t\t\t\t\t\\\n+\t\treturn Extensible::_d<Private>();\t\t\t\\\n+\t}\n \n #define LIBCAMERA_DECLARE_PUBLIC(klass)\t\t\t\t\t\\\n \tfriend class klass;\t\t\t\t\t\t\\\n \tusing Public = klass;\n \n #define LIBCAMERA_D_PTR()\t\t\t\t\t\t\\\n-\t_d<Private>();\n+\t_d();\n \n #define LIBCAMERA_O_PTR()\t\t\t\t\t\t\\\n \t_o<Public>();\n", "prefixes": [ "libcamera-devel", "v2", "1/3" ] }