[{"id":23450,"web_url":"https://patchwork.libcamera.org/comment/23450/","msgid":"<20220617135014.nqvu7zit77gkyx2b@uno.localdomain>","date":"2022-06-17T13:50:14","subject":"Re: [libcamera-devel] [PATCH 5/7] libcamera: yaml_parser: Remove\n\tmemberNames() function","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent\n\nOn Thu, Jun 16, 2022 at 05:24:01PM +0300, Laurent Pinchart via libcamera-devel wrote:\n> Now that YamlObject supports iteration, the memberNames() function isn't\n> useful anymore as it can be implemented using utils::map_keys() if\n> really needed. Drop it.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> ---\n>  include/libcamera/internal/yaml_parser.h |  1 -\n>  src/libcamera/yaml_parser.cpp            | 22 ----------------------\n>  test/yaml-parser.cpp                     | 10 ----------\n>  3 files changed, 33 deletions(-)\n>\n> diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h\n> index 8edd32354184..811be1affcc0 100644\n> --- a/include/libcamera/internal/yaml_parser.h\n> +++ b/include/libcamera/internal/yaml_parser.h\n> @@ -172,7 +172,6 @@ public:\n>\n>  \tbool contains(const std::string &key) const;\n>  \tconst YamlObject &operator[](const std::string &key) const;\n> -\tstd::vector<std::string> memberNames() const;\n>\n>  private:\n>  \tLIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject)\n> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\n> index 4df7e5a33d47..9b6e70cbfcf3 100644\n> --- a/src/libcamera/yaml_parser.cpp\n> +++ b/src/libcamera/yaml_parser.cpp\n> @@ -335,28 +335,6 @@ bool YamlObject::contains(const std::string &key) const\n>  \treturn true;\n>  }\n>\n> -/**\n> - * \\fn YamlObject::memberNames()\n> - * \\brief Retrieve all member names of the dictionary\n> - *\n> - * This function retrieve member names of a YamlObject. Only YamlObject\n> - * instances of Dictionary type associate elements with names, calling this\n> - * function on other types of instances is invalid and results in undefined\n> - * behaviour.\n> - *\n> - * \\todo Replace this function with an iterator-based API\n> - *\n> - * \\return A vector of string as the member names\n> - */\n> -std::vector<std::string> YamlObject::memberNames() const\n> -{\n> -\tstd::vector<std::string> memberNames;\n> -\tfor (auto &[key, _] : dictionary_)\n> -\t\tmemberNames.push_back(key);\n> -\n> -\treturn memberNames;\n> -}\n> -\n>  /**\n>   * \\fn YamlObject::operator[](const std::string &key) const\n>   * \\brief Retrieve a member by name from the dictionary\n> diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp\n> index ab6e9a01c0fe..38f848232fa6 100644\n> --- a/test/yaml-parser.cpp\n> +++ b/test/yaml-parser.cpp\n> @@ -500,16 +500,6 @@ protected:\n>  \t\t/* Make sure utils::map_keys() works on the adapter. */\n>  \t\t(void)utils::map_keys(dictObj.asDict());\n>\n> -\t\tauto memeberNames = dictObj.memberNames();\n> -\t\tsort(memeberNames.begin(), memeberNames.end());\n> -\n> -\t\tif (memeberNames[0] != \"a\" ||\n> -\t\t    memeberNames[1] != \"b\" ||\n> -\t\t    memeberNames[2] != \"c\") {\n> -\t\t\tcerr << \"Dictionary object fail to parse member names\" << std::endl;\n> -\t\t\treturn TestFail;\n> -\t\t}\n> -\n>  \t\t/* Test leveled objects */\n>  \t\tauto &level1Obj = (*root)[\"level1\"];\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\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 1C02CBD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 13:50:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B7E0265639;\n\tFri, 17 Jun 2022 15:50:16 +0200 (CEST)","from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CF84165633\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 15:50:15 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 7112D20000A;\n\tFri, 17 Jun 2022 13:50:15 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655473816;\n\tbh=j7B5UsqhlTWVWUaV4GnNQqPm79kuH3bco3lPRvykllA=;\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=cuFLlcWG45NYvctu7+p9aq9QR7Hsi2hGO+QZ27VOgMFPgdeUaAyk7cQWVWdbEOiDm\n\t14VH75xMuduEWTRCGFz+VbEKC6eg+c+g6Ffat7gO8Oh79u1XHdFtoNArRBoBkiCduP\n\tufHUNFGEKYiIEE7yFDXUMnLtoSfL8KoMClLy9ev2H6ZpVBYzdZSBmFogXHH0hRPBWk\n\tUurpHVO25gjoFu7kfLmNF1r+jCAfWnLf9xZ9NjkjqdRTlpSOLUZ66jIMfvNp/vOSHh\n\tN+baL4KhtB9FC1R5htNw61GCyN/HFhaks8Uf5nL5tz0axWxwRgL0mNkzFUrsRW2T9C\n\tr7Cw6mNfpcc6A==","Date":"Fri, 17 Jun 2022 15:50:14 +0200","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20220617135014.nqvu7zit77gkyx2b@uno.localdomain>","References":"<20220616142403.20723-1-laurent.pinchart@ideasonboard.com>\n\t<20220616142403.20723-6-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220616142403.20723-6-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 5/7] libcamera: yaml_parser: Remove\n\tmemberNames() function","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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23485,"web_url":"https://patchwork.libcamera.org/comment/23485/","msgid":"<CAJAuwMnFu7Kpm5cbjvbzNf5rSh+SA-cfMsZCDsBEmG3r+UbxDg@mail.gmail.com>","date":"2022-06-20T12:03:53","subject":"Re: [libcamera-devel] [PATCH 5/7] libcamera: yaml_parser: Remove\n\tmemberNames() function","submitter":{"id":98,"url":"https://patchwork.libcamera.org/api/people/98/","name":"Hanlin Chen","email":"hanlinchen@chromium.org"},"content":"Hi Laurent,\n\nOn Fri, Jun 17, 2022 at 9:50 PM Jacopo Mondi via libcamera-devel\n<libcamera-devel@lists.libcamera.org> wrote:\n>\n> Hi Laurent\n>\n> On Thu, Jun 16, 2022 at 05:24:01PM +0300, Laurent Pinchart via libcamera-devel wrote:\n> > Now that YamlObject supports iteration, the memberNames() function isn't\n> > useful anymore as it can be implemented using utils::map_keys() if\n> > really needed. Drop it.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Han-Lin Chen <hanlinchen@chromium.org>\n\nThanks.\n\n>\n> Thanks\n>   j\n>\n> > ---\n> >  include/libcamera/internal/yaml_parser.h |  1 -\n> >  src/libcamera/yaml_parser.cpp            | 22 ----------------------\n> >  test/yaml-parser.cpp                     | 10 ----------\n> >  3 files changed, 33 deletions(-)\n> >\n> > diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h\n> > index 8edd32354184..811be1affcc0 100644\n> > --- a/include/libcamera/internal/yaml_parser.h\n> > +++ b/include/libcamera/internal/yaml_parser.h\n> > @@ -172,7 +172,6 @@ public:\n> >\n> >       bool contains(const std::string &key) const;\n> >       const YamlObject &operator[](const std::string &key) const;\n> > -     std::vector<std::string> memberNames() const;\n> >\n> >  private:\n> >       LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject)\n> > diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\n> > index 4df7e5a33d47..9b6e70cbfcf3 100644\n> > --- a/src/libcamera/yaml_parser.cpp\n> > +++ b/src/libcamera/yaml_parser.cpp\n> > @@ -335,28 +335,6 @@ bool YamlObject::contains(const std::string &key) const\n> >       return true;\n> >  }\n> >\n> > -/**\n> > - * \\fn YamlObject::memberNames()\n> > - * \\brief Retrieve all member names of the dictionary\n> > - *\n> > - * This function retrieve member names of a YamlObject. Only YamlObject\n> > - * instances of Dictionary type associate elements with names, calling this\n> > - * function on other types of instances is invalid and results in undefined\n> > - * behaviour.\n> > - *\n> > - * \\todo Replace this function with an iterator-based API\n> > - *\n> > - * \\return A vector of string as the member names\n> > - */\n> > -std::vector<std::string> YamlObject::memberNames() const\n> > -{\n> > -     std::vector<std::string> memberNames;\n> > -     for (auto &[key, _] : dictionary_)\n> > -             memberNames.push_back(key);\n> > -\n> > -     return memberNames;\n> > -}\n> > -\n> >  /**\n> >   * \\fn YamlObject::operator[](const std::string &key) const\n> >   * \\brief Retrieve a member by name from the dictionary\n> > diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp\n> > index ab6e9a01c0fe..38f848232fa6 100644\n> > --- a/test/yaml-parser.cpp\n> > +++ b/test/yaml-parser.cpp\n> > @@ -500,16 +500,6 @@ protected:\n> >               /* Make sure utils::map_keys() works on the adapter. */\n> >               (void)utils::map_keys(dictObj.asDict());\n> >\n> > -             auto memeberNames = dictObj.memberNames();\n> > -             sort(memeberNames.begin(), memeberNames.end());\n> > -\n> > -             if (memeberNames[0] != \"a\" ||\n> > -                 memeberNames[1] != \"b\" ||\n> > -                 memeberNames[2] != \"c\") {\n> > -                     cerr << \"Dictionary object fail to parse member names\" << std::endl;\n> > -                     return TestFail;\n> > -             }\n> > -\n> >               /* Test leveled objects */\n> >               auto &level1Obj = (*root)[\"level1\"];\n> >\n> > --\n> > Regards,\n> >\n> > Laurent Pinchart\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 A586EBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jun 2022 12:05:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 723C365635;\n\tMon, 20 Jun 2022 14:05:01 +0200 (CEST)","from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com\n\t[IPv6:2607:f8b0:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A9D2B60498\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jun 2022 14:04:59 +0200 (CEST)","by mail-ot1-x32d.google.com with SMTP id\n\t93-20020a9d02e6000000b0060c252ee7a4so8170032otl.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jun 2022 05:04:59 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655726701;\n\tbh=8+hL2uBEaPiRQ2VcfI4D+z3jt54CYgjwRnvOO/giw6Y=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=L9WDpXaiJCkyfcu+a0xRPMd4xHprRxzoAb3/2PCrBYfbFmPgaHm/9q/1a0ejuP4LE\n\ttdyk4N2cQjT2BGtqIeeXLWdrGGeDrVlmRNWmKnzdAPc7hw+35tV3e4IQL5LcC1pWzL\n\tS+ntSTfRoi1Vk5KzuvHNGO9gZETwHg46wsyDS0fgSsMvPNqCoTWpvYFhd/ih+cUQos\n\t+6V5CLkZDVi7ipu7jILWkBVIH0XFTSY06GOtWEav54VC98YZChXYm2cdZjYadFrb9f\n\tMEADdcTWSrR1rvzHeTNy9rNtDmxKWgDC0OGmNRiEqgfkFpufqOxWyufLE/bXD2+GGG\n\tuCrGotK/bDNJA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=74g29JUi4lvEiCFeJ6Et79VvRlLNJjW/ApgWwO55lXw=;\n\tb=m2KBBsypTai3bZLecFZQ6su65tegKKETNL7kMhVkYWEoe/m1np7HpkL8ni88M+BAfg\n\tPJ+yEIH2Oo6gxCE+DEJSTLVohfTzdJ0WkeX6fS1fd85AtuLjQlm4Uf2n0zXNMaMIQPIK\n\tYzuiHbCzsssZi8EjMTUyGJsUY4YNwnxkTpuJk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"m2KBBsyp\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=74g29JUi4lvEiCFeJ6Et79VvRlLNJjW/ApgWwO55lXw=;\n\tb=qsu966nU9B05My1BGpendPYQZaBq8o9MsGP3FFmUhD/+qcS2ITePj7DKNSu9dnKpk9\n\tkitjjiPS4AxdTTMYlCwqOdycejRiDe/8Ra/9X5VbbugjWLy7nRfodfPssquHPyQp0wvp\n\tSWB4LheepLB84gb+OEKDMHnKk1n8aLWpb3OCPBOu81B8KMYOq1Oi/IuumAZTGeOfy7XC\n\t06GigjrJyG+NsQxaNh91o2YR27J/TiIhw4ksJ5C18ycbf8Oy/2uruDG10iUyc/ShzUOM\n\tyi5n5Q8zd5DaezWFQCzL8TNIy/2YZvhbDeNJRDeK3A6oH5iCNsSgWvXlOvfHHABqwLH2\n\tNF/w==","X-Gm-Message-State":"AJIora8I3/eRx3/XnDaGbxZ/beH7cmZ5FSZJ2QGYtmv1AhnSHxZSjcjm\n\trqkXx8MN3MOIUzMK/lSqZg7uOj95SE3xa173c9/A6w==","X-Google-Smtp-Source":"AGRyM1szDqS461yLLG3Lh2vJFbAn+/T6/ysKmLU3D5tgW4N/XebjxV3mDRKz8Rchp2EY4Oc/MhmZC/h/KyCJ0RyLHeM=","X-Received":"by 2002:a9d:5a9b:0:b0:60b:faf0:a1aa with SMTP id\n\tw27-20020a9d5a9b000000b0060bfaf0a1aamr8865406oth.176.1655726698207;\n\tMon, 20 Jun 2022 05:04:58 -0700 (PDT)","MIME-Version":"1.0","References":"<20220616142403.20723-1-laurent.pinchart@ideasonboard.com>\n\t<20220616142403.20723-6-laurent.pinchart@ideasonboard.com>\n\t<20220617135014.nqvu7zit77gkyx2b@uno.localdomain>","In-Reply-To":"<20220617135014.nqvu7zit77gkyx2b@uno.localdomain>","Date":"Mon, 20 Jun 2022 20:03:53 +0800","Message-ID":"<CAJAuwMnFu7Kpm5cbjvbzNf5rSh+SA-cfMsZCDsBEmG3r+UbxDg@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH 5/7] libcamera: yaml_parser: Remove\n\tmemberNames() function","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":"Hanlin Chen via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Hanlin Chen <hanlinchen@chromium.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]