[{"id":2723,"web_url":"https://patchwork.libcamera.org/comment/2723/","msgid":"<20190929100126.qotshe5n7pxbrxyk@uno.localdomain>","date":"2019-09-29T10:01:26","subject":"Re: [libcamera-devel] [PATCH 05/12] libcamera: controls: Remove the\n\tunused ControlList::update() method","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Sat, Sep 28, 2019 at 06:22:31PM +0300, Laurent Pinchart wrote:\n> The ControlList::update() method is unused. While it is meant to fulfil\n> a need of applications, having no user means that it is most probably\n> not correctly designed. Remove the method, we will add it back later if\n> needed.\n>\n\nThis indeed removes the discussion if this operation should have been\ncalled update() or merge()\n\nIf not used, let's drop it\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  include/libcamera/controls.h   |  2 --\n>  src/libcamera/controls.cpp     | 28 ----------------------\n>  test/controls/control_list.cpp | 43 ----------------------------------\n>  3 files changed, 73 deletions(-)\n>\n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index 9698bd1dd383..d4a74ada1b6a 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -158,8 +158,6 @@ public:\n>  \t\tval->set<T>(value);\n>  \t}\n>\n> -\tvoid update(const ControlList &list);\n> -\n>  private:\n>  \tconst ControlValue *find(const ControlId &id) const;\n>  \tControlValue *find(const ControlId &id);\n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index 8886660b7617..62cb2ff822bb 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -511,32 +511,4 @@ ControlValue *ControlList::find(const ControlId &id)\n>  \treturn &controls_[&id];\n>  }\n>\n> -/**\n> - * \\brief Update the list with a union of itself and \\a other\n> - * \\param other The other list\n> - *\n> - * Update the control list to include all values from the \\a other list.\n> - * Elements in the list whose control IDs are contained in \\a other are updated\n> - * with the value from \\a other. Elements in the \\a other list that have no\n> - * corresponding element in the list are added to the list with their value.\n> - *\n> - * The behaviour is undefined if the two lists refer to different Camera\n> - * instances.\n> - */\n> -void ControlList::update(const ControlList &other)\n> -{\n> -\tif (other.camera_ != camera_) {\n> -\t\tLOG(Controls, Error)\n> -\t\t\t<< \"Can't update ControlList from a different camera\";\n> -\t\treturn;\n> -\t}\n> -\n> -\tfor (auto it : other) {\n> -\t\tconst ControlId *id = it.first;\n> -\t\tconst ControlValue &value = it.second;\n> -\n> -\t\tcontrols_[id] = value;\n> -\t}\n> -}\n> -\n>  } /* namespace libcamera */\n> diff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp\n> index 053696814b67..8469ecf09439 100644\n> --- a/test/controls/control_list.cpp\n> +++ b/test/controls/control_list.cpp\n> @@ -141,49 +141,6 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>\n> -\t\t/*\n> -\t\t * Test list merging. Create a new list, add two controls with\n> -\t\t * one overlapping the existing list, merge the lists and clear\n> -\t\t * the old list. Verify that the new list is empty and that the\n> -\t\t * new list contains the expected items and values.\n> -\t\t */\n> -\t\tControlList newList(camera_.get());\n> -\n> -\t\tnewList.set(controls::Brightness, 128);\n> -\t\tnewList.set(controls::Saturation, 255);\n> -\t\tnewList.update(list);\n> -\n> -\t\tlist.clear();\n> -\n> -\t\tif (list.size() != 0) {\n> -\t\t\tcout << \"Old List should contain zero items\" << endl;\n> -\t\t\treturn TestFail;\n> -\t\t}\n> -\n> -\t\tif (!list.empty()) {\n> -\t\t\tcout << \"Old List should be empty\" << endl;\n> -\t\t\treturn TestFail;\n> -\t\t}\n> -\n> -\t\tif (newList.size() != 3) {\n> -\t\t\tcout << \"New list has incorrect size\" << endl;\n> -\t\t\treturn TestFail;\n> -\t\t}\n> -\n> -\t\tif (!newList.contains(controls::Brightness) ||\n> -\t\t    !newList.contains(controls::Contrast) ||\n> -\t\t    !newList.contains(controls::Saturation)) {\n> -\t\t\tcout << \"New list contains incorrect items\" << endl;\n> -\t\t\treturn TestFail;\n> -\t\t}\n> -\n> -\t\tif (newList.get(controls::Brightness) != 10 ||\n> -\t\t    newList.get(controls::Contrast) != 20 ||\n> -\t\t    newList.get(controls::Saturation) != 255) {\n> -\t\t\tcout << \"New list contains incorrect values\" << endl;\n> -\t\t\treturn TestFail;\n> -\t\t}\n> -\n>  \t\treturn TestPass;\n>  \t}\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4B60F60BE8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 29 Sep 2019 11:59:44 +0200 (CEST)","from uno.localdomain\n\t(host7-199-dynamic.171-212-r.retail.telecomitalia.it [212.171.199.7])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 9D796FF808;\n\tSun, 29 Sep 2019 09:59:43 +0000 (UTC)"],"X-Originating-IP":"212.171.199.7","Date":"Sun, 29 Sep 2019 12:01:26 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190929100126.qotshe5n7pxbrxyk@uno.localdomain>","References":"<20190928152238.23752-1-laurent.pinchart@ideasonboard.com>\n\t<20190928152238.23752-6-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"2p5tiqxrzggzyiiy\"","Content-Disposition":"inline","In-Reply-To":"<20190928152238.23752-6-laurent.pinchart@ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 05/12] libcamera: controls: Remove the\n\tunused ControlList::update() method","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>","X-List-Received-Date":"Sun, 29 Sep 2019 09:59:44 -0000"}}]