From patchwork Mon Oct 31 11:45:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17739 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 6082BC3287 for ; Mon, 31 Oct 2022 11:45:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A73306304D; Mon, 31 Oct 2022 12:45:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1667216735; bh=QlbSyZb55JOooihaGg2jancKeP/f5baLUDuOMGUyyuI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=m5F8uDtV1ENXY7zVhypBBV08948D/jtt/ABFcSJYyv5UK/PRDQpB+eKl2fO1JOkSb GGeBdQE2Z/Sb092iXK/fVRcpBUO9RzWLsa7X+hYK0x+eMINc8elyik6A7qBgIeXohK A1tYOuXcZPjmLOen9qHSyrA/0WzOLdp2vZ34xEpAb80guygLquBGG023uUdEYSGA2j oySlM9pGnsY1PmvbavwlE9+Nw+D0TbbZKVXvbmd19Lwe7wNCyRzdkv5H8SkcAcSThb hiFv4jLNRvdPkgyXurlZo45rWc6a1fM9j6nnBAM1XJbqnO+Dinl9prbKI8qGUdHfu4 qCRaGoo8nPh+A== Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 26D1963032 for ; Mon, 31 Oct 2022 12:45:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="UGZIgmqC"; dkim-atps=neutral Received: by mail-wr1-x432.google.com with SMTP id a14so15581626wru.5 for ; Mon, 31 Oct 2022 04:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yn36HTpXKWZYQWKnBoWmhX3QM0Hd57lWMTJ6qGaKsMY=; b=UGZIgmqCHxJEqx10cMo4+Qs2nLCn2CKBdn2jTMlIZmaU4stPAbosAiCQx0WqKYjRDd w8SseGLHbliVoOr/4p+5gzdn9+hW9q/9531B3q35VrRn/78mxOamt34ryIGZfaE11g8k JkgDgXOTqDczAUMmKlj0O7MSxNmtSvbzrVW9CGuUCpk9IgKSofVfO42k+2/J9AE5wQYn /owKN0EWxTPhEC2GPF5SycHcJ+oH9TgRuQsgpvL7WxKprt1Eq/PWOknn+y/eZPuamC9R c7O/EzBPJbG9D29ruReXlD2XHdeJl4smjVzP6QZoFThM3pbs16ErHliEI29fRc0ev5Oh lI4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yn36HTpXKWZYQWKnBoWmhX3QM0Hd57lWMTJ6qGaKsMY=; b=msBLdZEcG7L5nn+0XsoYdrZp5lA0PlIyzxbBbwAbVD3wI9Pwag9I6WtY31sTnjTQDc Ga8TSGP6yebdjIts4dFqhgN8pxsBB+xKAG/fDym0gBeGxhGc+vDmE8brOZqUyGU8OzDO ng986pkBtse1YIu+nkfm9U+gmOmU0pcgEiohcBHADRzKQu/MZGkoO/AJWq/QgqdkWaK1 mKIkwXu702K6tQv/H2YeWjwGljWConn4cFQOJsd5CNGO7mOvDtgCNQpHzUtAP15/zljC Whk4pf6lPNSp/72K8vkhyvPCKSo4+15l3m6uDyPjomCCqm0d82WHbOh11MZzhwPZS/pm viOA== X-Gm-Message-State: ACrzQf1eagUzG5w+T1LWBLh6PmS+2wxeNZOXCVp/uqJp4gKfwgY/3uVf +GC0qGsmSynH8RDgYrihiZUNC4Zew8tJdQ== X-Google-Smtp-Source: AMsMyM6ALfszR/ykSZ0uZxX1zrp0URaFPSBXtAACh1LujF/0XWzLPn99EdF9r3jvgdZfD0TBApgPCw== X-Received: by 2002:a05:6000:4086:b0:236:b659:471d with SMTP id da6-20020a056000408600b00236b659471dmr6336829wrb.563.1667216730394; Mon, 31 Oct 2022 04:45:30 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h11-20020adff18b000000b0023677e1157fsm6936354wro.56.2022.10.31.04.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 04:45:29 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Oct 2022 11:45:19 +0000 Message-Id: <20221031114522.14215-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031114522.14215-1-naush@raspberrypi.com> References: <20221031114522.14215-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 4/7] ipa: raspberrypi: Add RPiController::Metadata::mergeCopy X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a new member function to RPiController::Metadata that copies unique key/value pairs from one object to the other. This is different from std::map::merge that would remove the key/value pairs from the source object. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham --- src/ipa/raspberrypi/controller/metadata.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ipa/raspberrypi/controller/metadata.h b/src/ipa/raspberrypi/controller/metadata.h index 0f7ebfaf4c25..ddce491784e9 100644 --- a/src/ipa/raspberrypi/controller/metadata.h +++ b/src/ipa/raspberrypi/controller/metadata.h @@ -78,6 +78,16 @@ public: data_.merge(other.data_); } + void mergeCopy(const Metadata &other) + { + std::scoped_lock lock(mutex_, other.mutex_); + /* + * If the metadata key exists, ignore this item and copy only + * unique key/value pairs. + */ + data_.insert(other.data_.begin(), other.data_.end()); + } + template T *getLocked(std::string const &tag) {