[{"id":24452,"web_url":"https://patchwork.libcamera.org/comment/24452/","msgid":"<YvG0lsOHb4uWGWoF@pendragon.ideasonboard.com>","date":"2022-08-09T01:12:54","subject":"Re: [libcamera-devel] [PATCH 3/9] libcamera: flags: Add friend\n\tclass IPADataSerializer","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Wed, Aug 03, 2022 at 08:21:44PM +0900, Paul Elder via libcamera-devel wrote:\n> To prepare for the ability to send Flags over IPC, add IPADataSerializer\n> as a friend class to Flags.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  include/libcamera/base/flags.h | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/include/libcamera/base/flags.h b/include/libcamera/base/flags.h\n> index a1b404bd..43afdf26 100644\n> --- a/include/libcamera/base/flags.h\n> +++ b/include/libcamera/base/flags.h\n> @@ -137,6 +137,9 @@ public:\n>  \t}\n>  \n>  private:\n> +\ttemplate<typename>\n> +\tfriend class IPADataSerializer;\n\nI'd rather not do this, to avoid exposing internals in the public API.\nYou can convert a Flags to the raw value with operator Type(), which is\ncalled by\n\n\tstatic_cast<Flags<...>::Type>(flags)\n\nI however suspect you need the friend statement for the other way\naround. I think you can use the Flags(E flag) constructor then, casting\nthe deserialized uint32_t to a E first.\n\n> +\n>  \tType value_;\n>  };\n>","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 BC507C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Aug 2022 01:13:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1675C6332B;\n\tTue,  9 Aug 2022 03:13:08 +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 574926330E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Aug 2022 03:13:06 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B6F35481;\n\tTue,  9 Aug 2022 03:13:05 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660007588;\n\tbh=cQDw3z64B/n9tXz8LZBMzuFHn7p07eklfyMnFkpHrj0=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=yob9+P3XX9TM3GsNGMQDuckXNBlmliRlNb5iB3YnDG5a4UTB6cT1fjDwRNHiH2JXG\n\tsXC6FLAvs/ynKW7bZ0k31M7FGozu8MKrH+8Vqjc0c1fuSCub/gyQZ9doN8e94VnPYm\n\tqzoYfquiv16wGvXnUYOCN0o7KjNUO8t2JJIRq0YmSrpH47EzZfHCHUsW6vfuPw4NHo\n\tgUA7HtlPrn6yhkXB+9JapD1vKzK7kOR/OhgSDX826ZOBhJJ5V60U5+pwPa2iaY/W1C\n\tJXLRX60jENNBTGOUmmV0z/k3ksRYhKncd1RGz625kpLjX7bzPB6DOKCFIlEjY8GTYS\n\tuoOjpihrIvDXw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660007585;\n\tbh=cQDw3z64B/n9tXz8LZBMzuFHn7p07eklfyMnFkpHrj0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=VDmV1iFFtewjqy+Ce1cos6HvBik3q91kTIvVnCoa1xn7PKMBp5hIJxqhfL6VPODVL\n\tT8y572tc2FMgv5R5gT3607l04EplDEdQs67DT3csfeeHWUFHWiTICZigNuZU9EwWfP\n\tBdCcMrCMJQuVIN8zcrfMRTCH6KAxAScbQ2V7Ui4E="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"VDmV1iFF\"; dkim-atps=neutral","Date":"Tue, 9 Aug 2022 04:12:54 +0300","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<YvG0lsOHb4uWGWoF@pendragon.ideasonboard.com>","References":"<20220803112150.3040287-1-paul.elder@ideasonboard.com>\n\t<20220803112150.3040287-4-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220803112150.3040287-4-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 3/9] libcamera: flags: Add friend\n\tclass IPADataSerializer","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]