From patchwork Mon Apr 19 13:34:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12005 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 D6399BD814 for ; Mon, 19 Apr 2021 13:35:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 930AB68847; Mon, 19 Apr 2021 15:35:04 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="WTpkoMh2"; dkim-atps=neutral Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 45C1668839 for ; Mon, 19 Apr 2021 15:35:01 +0200 (CEST) Received: by mail-wr1-x429.google.com with SMTP id j5so33117808wrn.4 for ; Mon, 19 Apr 2021 06:35:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ByDL9nYy7x4L3Tto/bzy+16JVkmrBlZp1522yVKSnPo=; b=WTpkoMh2H19oXim9dqh8Y0Z2K2s5qNXE9JeGa6+0v0BbaTdYJoqELK5cUX2qDWoRQo YrYWG5HEJ+5sYLL1xNVuNuguteHuQ9UKiHJacumk0sg3OJTrgAoixdxwr2x8n1G5LFaU XMBmhy88EolMarYA6RyFaynSX9QlFAopvdhjtzjZvc17keJinPGxGsr0CB/g94KXynSr pJ/8m6+5TbgZ/6UAhGD39A6pwzHazxQsil8ZxqpJ+chqz2ORkxpkPhKAStsFeUoy6gb5 BddvPH3dWlqtYDknKyDoDrrzzvXr4cHRvSdgghbxT37+1Oc3kbrsBGo77GqMjDN34s+A ZPqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ByDL9nYy7x4L3Tto/bzy+16JVkmrBlZp1522yVKSnPo=; b=CZD5Eq95sdX1fehXf0fpWc2QpVDPTbG0cqJSz7gx5jx7dVpU70UiDyxmFQ5yazK6ja WGe+G6+8o146Ebck8ZPvxpcm4WW+EanPP/AGJbY4N8gjG9DamlXFdQd+rl3FhkRtDlg/ e2A8oJw3E2Fq5PZNHSjzciuCHjQRYng77Bte+n06iZFjUV+4f/bXUVhHqD/7NXYrulxG cEIykdwAEFGEu4HOgpKQXUslhpZ1XZbtt3hqHBjf7j/8aFzCV4MrnFxqfvWQyuYp3Elu lYFYN6dLc3oANO+JBVCtXgnuXo/mseNlXQzVpM8u0Evv590Ml+EtUhKAfY+ReX3jtGss k64w== X-Gm-Message-State: AOAM533oDdL05wscJp4Iph1SpkYgaBP2jdGOi56mKC2iqN86T6Qn0NXU oeFfcnASWDJDsQ1V0ttDnCEtoN9FfU5zrw== X-Google-Smtp-Source: ABdhPJzLg57UhnlUg6WTznD5fuvOjOr1Ej5SAtG1we4br5V2HjHr4SLXZSwQmQkbDkEQTU4MRbB2hA== X-Received: by 2002:a5d:6d0c:: with SMTP id e12mr14206687wrq.321.1618839300796; Mon, 19 Apr 2021 06:35:00 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:15:5363:8f56:4f84:754]) by smtp.gmail.com with ESMTPSA id k11sm19952238wrx.88.2021.04.19.06.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 06:35:00 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 19 Apr 2021 14:34:50 +0100 Message-Id: <20210419133451.263733-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210419133451.263733-1-naush@raspberrypi.com> References: <20210419133451.263733-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 4/5] ipa: raspberrypi: Add Merge method to RPiController::Metadata 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a new Merge method to the Metadata class. This will move all key/value pairs between a source and destination metadata object. Once complete, the source Metadata object will be empty. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- src/ipa/raspberrypi/controller/metadata.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ipa/raspberrypi/controller/metadata.hpp b/src/ipa/raspberrypi/controller/metadata.hpp index 319f2320fc70..1d3e941b3e52 100644 --- a/src/ipa/raspberrypi/controller/metadata.hpp +++ b/src/ipa/raspberrypi/controller/metadata.hpp @@ -75,6 +75,18 @@ public: return *this; } + void Merge(Metadata &other) + { + std::lock_guard lock(mutex_); + std::lock_guard other_lock(other.mutex_); + + for (auto const &kv: other.data_) + data_[kv.first] = std::move(kv.second); + + /* Render the other object as empty now! */ + other.data_.clear(); + } + template T *GetLocked(std::string const &tag) {