From patchwork Mon Apr 19 13:17:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11999 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 814DDBD812 for ; Mon, 19 Apr 2021 13:17:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3DDD768839; Mon, 19 Apr 2021 15:17:32 +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="VFx/h1cN"; dkim-atps=neutral Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4EE9068830 for ; Mon, 19 Apr 2021 15:17:29 +0200 (CEST) Received: by mail-wm1-x336.google.com with SMTP id n4-20020a05600c4f84b029013151278decso6834273wmq.4 for ; Mon, 19 Apr 2021 06:17:29 -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=VFx/h1cNXTdgknnNOD7+mHakOezi1fCrmb+jpNd2QwzbsLVvdYXQYRASmr2bm0SaHA zzXQLe+XS+mJjz7ZJgr8D3AG7J7X358q8PsD54fxWwoTi4XaF//RXQLgUr2B0x7CtkEV 7pMIYVdIb6YyUI7Fvbi0/7xpTNsvcx9pZNUcHqStPMUw3idwW8OqWbAivnisW5elUrHl w8reMyqXpx/+B4Fkc11iW6pDQq2cNWpgZpP6RL9nXdCyvAOBb7y1C2geq8V1HNi5N1Nt L5z3QkPpzWlyQ7lejSM7AMsPSo4wmMhSPIrNwIgMLuStOVi9WrX0ETILBX0xopOWBnPV EaQg== 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=kQSoGTdkjIJqalWem1Yxw4Mgl9skZyow/CcRj9AJ3kM81I4cXrUI81IBsklxuKBpD0 8jA1kNxHOutJxDNppo7JMS0XcARuPatv0fQuMgGn0vwHyp2oYD0roCgbfEpgCnqCZt/L fGPaRutlB3ncn5Oo30FSCCnGBdgXLYA4cDL2YKjHr8WnBQnU0pEN3hqFPRZyBNbB11x0 Wo1m6RqFI5y8mdRUFakHLMXwj4/NYqGS1xqy24kjh6BdrlIdCWC9Ggv7uryvMMUMn8xh kAA/YY6SNCM8jk8wIEuPAUQjVYE9xVHC07+s4ysWbL7WfG/9o2kHbsP3BKmUdkHTFa/X 6ERA== X-Gm-Message-State: AOAM533q8qD2ZFYogXUhJwmsZ0yLZReR1NO9XCU9mBqqk3+UPizDd6j7 4+7rhFt5eRiA2T2eMx0MuHwaaEL0KwB/2A== X-Google-Smtp-Source: ABdhPJx4sd5L0cvzuIVSb7627iCBgoDeyHtUFqg0IqySkbmRO7aYmSXCkC6/RXGsH5e6WS+ThgATiw== X-Received: by 2002:a1c:4b19:: with SMTP id y25mr21641864wma.91.1618838248772; Mon, 19 Apr 2021 06:17:28 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:15:5363:8f56:4f84:754]) by smtp.gmail.com with ESMTPSA id t6sm22335428wrx.38.2021.04.19.06.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 06:17:28 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 19 Apr 2021 14:17:14 +0100 Message-Id: <20210419131715.256802-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210419131715.256802-1-naush@raspberrypi.com> References: <20210419131715.256802-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 3/4] 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 --- 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) {