[{"id":25659,"web_url":"https://patchwork.libcamera.org/comment/25659/","msgid":"<166695884773.3974115.1076140265452655252@Monstersaurus>","date":"2022-10-28T12:07:27","subject":"Re: [libcamera-devel] [PATCH v4 4/7] ipa: raspberrypi: Add\n\tRPiController::Metadata::mergeCopy","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck via libcamera-devel (2022-10-19 10:01:04)\n> Add a new member function to RPiController::Metadata that copies unique\n> key/value pairs from one object to the other. This is different from\n> std::map::merge that would remove the key/value pairs from the source object.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/ipa/raspberrypi/controller/metadata.h | 10 ++++++++++\n>  1 file changed, 10 insertions(+)\n> \n> diff --git a/src/ipa/raspberrypi/controller/metadata.h b/src/ipa/raspberrypi/controller/metadata.h\n> index 0f7ebfaf4c25..ddce491784e9 100644\n> --- a/src/ipa/raspberrypi/controller/metadata.h\n> +++ b/src/ipa/raspberrypi/controller/metadata.h\n> @@ -78,6 +78,16 @@ public:\n>                 data_.merge(other.data_);\n>         }\n>  \n> +       void mergeCopy(const Metadata &other)\n> +       {\n> +               std::scoped_lock lock(mutex_, other.mutex_);\n> +               /*\n> +                * If the metadata key exists, ignore this item and copy only\n> +                * unique key/value pairs.\n> +                */\n> +               data_.insert(other.data_.begin(), other.data_.end());\n\nI keep coming back to this and wondering if the mergeCopy should be\ncalled insert, or if I just hate how STL handles merging two datasets.\n\nI think it's the later ;-) I've wanted to do similar things with\nControlLists.\n\nThat said, this is under ipa/raspberrypi/ so it's left for you to\nmaintain, so I'm fine with this.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n> +       }\n> +\n>         template<typename T>\n>         T *getLocked(std::string const &tag)\n>         {\n> -- \n> 2.25.1\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 75759BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Oct 2022 12:07:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C713E62FD8;\n\tFri, 28 Oct 2022 14:07:31 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0BFD861F4A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Oct 2022 14:07:31 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7EB0A6BE;\n\tFri, 28 Oct 2022 14:07:30 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666958851;\n\tbh=hWcYsDugZgh8VCT0E7aq0cTMFEzSxUA5ZCva8kBH+Ec=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=scw0twNUswO2iwCy9veqvZvQ6jLDgVSZhhSsbfbtwD8yPPswsGHXkDrX3dJ7TkDNB\n\tB45g5JcRExGNw7wXwBaTr9OH9C2POxZ5aItFC4oz4lqiYdI7QqWB67ucpwHtlaR7KH\n\tZ7GspU2YwmcFpSES8qb5sl/y+6PDHDEdYGgdDXTTscL3Chi4M/5+dNgmIF/MPKDAmc\n\t0Ce36G93JSoS1CiPf4FCqUn8rLRF8o66ym+aYd1AKvPmlOh0nevH7/v5r4VMu50LGn\n\tadj7UDIoRNtGsmsp5eaSrrYVLBshYDv34IJBAiFLTUDkd0Bx0SVcTxNowPJQCeZwOg\n\tI7WAr3PEVZn/Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1666958850;\n\tbh=hWcYsDugZgh8VCT0E7aq0cTMFEzSxUA5ZCva8kBH+Ec=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=ruJPhkg+iWFABFl7TjKamxk+Jn0OjORZqPzYvSCk0BCvwUhRSHfrY6D9TGYWcncMW\n\t5phPpuIYCDOJZKeQ23/QNIepJAM4sxamtXu5E4Ab7JPNin7GaJKZb35TM5bhPgkJiU\n\tJbtKzy02/k1veGYRXHgaZaGHgIR7YNhCc7+6tq9c="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ruJPhkg+\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20221019090107.19975-5-naush@raspberrypi.com>","References":"<20221019090107.19975-1-naush@raspberrypi.com>\n\t<20221019090107.19975-5-naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 28 Oct 2022 13:07:27 +0100","Message-ID":"<166695884773.3974115.1076140265452655252@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 4/7] ipa: raspberrypi: Add\n\tRPiController::Metadata::mergeCopy","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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]