[{"id":14454,"web_url":"https://patchwork.libcamera.org/comment/14454/","msgid":"<X/WWJBYKf77K52N/@oden.dyn.berto.se>","date":"2021-01-06T10:51:16","subject":"Re: [libcamera-devel] [PATCH v5 08/10] libcamera: media_object: Add\n\ta const version of dev()","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2021-01-05 13:31:26 +0100, Jacopo Mondi wrote:\n> Add a const version of the MediaObject::dev() method to be able to\n> retrieve a pointer to a const MediaDevice from a constant instance of\n> a MediaObject sub-class.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/internal/media_object.h | 1 +\n>  src/libcamera/media_object.cpp            | 6 ++++++\n>  2 files changed, 7 insertions(+)\n> \n> diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h\n> index 43a35bef8f35..2b336961f98d 100644\n> --- a/include/libcamera/internal/media_object.h\n> +++ b/include/libcamera/internal/media_object.h\n> @@ -22,6 +22,7 @@ class MediaObject\n>  {\n>  public:\n>  \tMediaDevice *device() { return dev_; }\n> +\tconst MediaDevice *device() const { return dev_; }\n>  \tunsigned int id() const { return id_; }\n>  \n>  protected:\n> diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\n> index 056036635902..cd3cd8ac17a4 100644\n> --- a/src/libcamera/media_object.cpp\n> +++ b/src/libcamera/media_object.cpp\n> @@ -71,6 +71,12 @@ LOG_DECLARE_CATEGORY(MediaDevice)\n>   * \\return The MediaDevice\n>   */\n>  \n> +/**\n> + * \\fn const MediaObject::device() const\n> + * \\brief Retrieve the const media device the media object belongs to\n> + * \\return The const MediaDevice\n> + */\n> +\n>  /**\n>   * \\fn MediaObject::id()\n>   * \\brief Retrieve the media object id\n> -- \n> 2.29.2\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 73C5AC0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Jan 2021 10:51:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 46361630BA;\n\tWed,  6 Jan 2021 11:51:19 +0100 (CET)","from mail-lf1-x133.google.com (mail-lf1-x133.google.com\n\t[IPv6:2a00:1450:4864:20::133])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D2DF6010B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Jan 2021 11:51:18 +0100 (CET)","by mail-lf1-x133.google.com with SMTP id m25so5470789lfc.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 06 Jan 2021 02:51:18 -0800 (PST)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tk11sm271413lfm.181.2021.01.06.02.51.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 06 Jan 2021 02:51:17 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"A9i19pU2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=Ed11l7gPodQCrUmIFi1E5Qn0x5t3ikIKlZcrMUaidm8=;\n\tb=A9i19pU2Y/gurVnxZdgZTswhxDlHZh0AmsVDyY1xOjXR+CkVg5BqSv+SpaaPKduN8N\n\tiRYnGDra3L/alN+N50nKzk8wo4+lamFxS8AQsoDSpD+oDegxfesrIafHePKu+U0qoryz\n\tLP7+5SVRQgm7k0c7Qq3b+6rlgBuiD8roqpfvw3zif/7EQ6s4o/5+8dz+9YCTvSmOLh5z\n\teZuqOO8DMI3vuhvnjvckYgFTJb5gJwniwDKSqxdYBIZGfclfJw9laSXB0K3A6LB2gWeX\n\tloe3RaFWr2+AVwPfWq4eK98JewJYUb1jIOerQ7/1FpzOt2XUulqFrpAB32crS+1N18br\n\tGyhA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=Ed11l7gPodQCrUmIFi1E5Qn0x5t3ikIKlZcrMUaidm8=;\n\tb=MBIn5SSVzIw0ZBznFiXACShf0/jxw3bxLu9tBhwl1KlWqlC22a+eujmGJpcepLIbam\n\tV9XmH8csHItF7E/v96V730cwa1hkneLpFsbzn0O7qFcYLgGfvQUANsGloSpuoDNErhA4\n\t4U25X2q1cbwhF3UqtG3VKWeIiIsN6rwdMCI22Ha0JG7iwuKo7GysLZtbokCk8BIltVqN\n\tsKQc+ndM0ZpvA62kBH0mfi8jbPRCaFA0FweolA1bLA04wLAvhW7IKXgMvEnXXeDTx12F\n\tsYEHHEU12Bu2eAhGwjI1fYUoY2xaKwmjsl/MfIeyCuMlD3wFb4PTjyemvFkHKl7thaH1\n\tRISg==","X-Gm-Message-State":"AOAM531MFTjHKknk2dcBQlQsJsB/yRM0r6D+m1HCDjKSF30rN3Uc69DM\n\t25uH4DoO6Sv9YrF05QtW/hH6xw==","X-Google-Smtp-Source":"ABdhPJxemCnwKEpw4sh21G34UF5D4fb7aeUjxyufs4YdqUkT/9Dsm9pGnUY4z27UG4n3UyUyOcMCdw==","X-Received":"by 2002:a2e:780a:: with SMTP id t10mr1754713ljc.67.1609930277697;\n\tWed, 06 Jan 2021 02:51:17 -0800 (PST)","Date":"Wed, 6 Jan 2021 11:51:16 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<X/WWJBYKf77K52N/@oden.dyn.berto.se>","References":"<20210105123128.617543-1-jacopo@jmondi.org>\n\t<20210105123128.617543-9-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210105123128.617543-9-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v5 08/10] libcamera: media_object: Add\n\ta const version of dev()","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14459,"web_url":"https://patchwork.libcamera.org/comment/14459/","msgid":"<X/Z3XfTlrCvo+NgO@pendragon.ideasonboard.com>","date":"2021-01-07T02:52:13","subject":"Re: [libcamera-devel] [PATCH v5 08/10] libcamera: media_object: Add\n\ta const version of dev()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Tue, Jan 05, 2021 at 01:31:26PM +0100, Jacopo Mondi wrote:\n> Add a const version of the MediaObject::dev() method to be able to\n> retrieve a pointer to a const MediaDevice from a constant instance of\n> a MediaObject sub-class.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  include/libcamera/internal/media_object.h | 1 +\n>  src/libcamera/media_object.cpp            | 6 ++++++\n>  2 files changed, 7 insertions(+)\n> \n> diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h\n> index 43a35bef8f35..2b336961f98d 100644\n> --- a/include/libcamera/internal/media_object.h\n> +++ b/include/libcamera/internal/media_object.h\n> @@ -22,6 +22,7 @@ class MediaObject\n>  {\n>  public:\n>  \tMediaDevice *device() { return dev_; }\n> +\tconst MediaDevice *device() const { return dev_; }\n>  \tunsigned int id() const { return id_; }\n>  \n>  protected:\n> diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\n> index 056036635902..cd3cd8ac17a4 100644\n> --- a/src/libcamera/media_object.cpp\n> +++ b/src/libcamera/media_object.cpp\n> @@ -71,6 +71,12 @@ LOG_DECLARE_CATEGORY(MediaDevice)\n>   * \\return The MediaDevice\n>   */\n>  \n> +/**\n> + * \\fn const MediaObject::device() const\n\nYou can drop the first const.\n\n> + * \\brief Retrieve the const media device the media object belongs to\n> + * \\return The const MediaDevice\n> + */\n\nDo you know about copydoc ?\n\n /**\n  * \\fn MediaObject::device() const\n  * \\copydoc MediaObject::device()\n  */\n\n(You may need to move the documentation of the existing function to the\nconst version, and use \\copydoc MediaObject::device() const in the\nnon-const version, if doxygen has trouble with the above)\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n>  /**\n>   * \\fn MediaObject::id()\n>   * \\brief Retrieve the media object id","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 09963C0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  7 Jan 2021 02:52:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D84B630BB;\n\tThu,  7 Jan 2021 03:52:27 +0100 (CET)","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 D2DF76010E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  7 Jan 2021 03:52:25 +0100 (CET)","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 4DDBA2E0;\n\tThu,  7 Jan 2021 03:52:25 +0100 (CET)"],"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=\"C1c9NEFA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1609987945;\n\tbh=Yjf/A+oZYZf6vRoZphjP6srSvIEsObUgmXk053uJXas=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=C1c9NEFA2ksadd17Cpej+EwxNu18Jmw7BvKLXMtz1579oPYXExJ41IQS9mqapKUSh\n\toYGVIjAKD2KBmBnxjCu1y5KWjCwaAprrjU3JdIWKP2vIm6aX86E+x3FRG/EH9ThWji\n\tAxQdB9dBwciKp5aQLhYwK/9BuDxw6pRiJLboPF3Y=","Date":"Thu, 7 Jan 2021 04:52:13 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<X/Z3XfTlrCvo+NgO@pendragon.ideasonboard.com>","References":"<20210105123128.617543-1-jacopo@jmondi.org>\n\t<20210105123128.617543-9-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210105123128.617543-9-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v5 08/10] libcamera: media_object: Add\n\ta const version of dev()","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>","Cc":"libcamera-devel@lists.libcamera.org","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>"}}]