From patchwork Mon May 10 09:58:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12237 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 4E350BF829 for ; Mon, 10 May 2021 09:59:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CA4426892A; Mon, 10 May 2021 11:59:12 +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="SKFO0IHu"; dkim-atps=neutral Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 13EF76890C for ; Mon, 10 May 2021 11:59:09 +0200 (CEST) Received: by mail-wm1-x329.google.com with SMTP id o26-20020a1c4d1a0000b0290146e1feccdaso9386547wmh.0 for ; Mon, 10 May 2021 02:59:09 -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=6nvwrdwFQFfVWryhozrzfX48ubzoceWz0iZ+FUQS5OE=; b=SKFO0IHuND9o7ofr1KZo3H8T7S3MskA+meZeU+XjcJgt99ePzN3UyDczWF/DTP5SBX MDpt/1+a6zcXS6JrfO8k3cdnD//AN8JAqIcp91N3WVb+awDjIcSqTkl3IfJ0G7RLfwx3 57mJtxx6h2t6XoJqux9NUy8i9a7j0mtjRTN6Z0Ds9hXMbdft6PovmCIBc6WIpUpCD24C 8CALAKUu5cVb6I9n4yXDqSmEwh/ECe6mRcNIyDP6OcfowacxuNSU9X8GsaYBomdIMylD q/G29vAvIkEFRGx85sFpIvF8M5Wh1onmxVYhMtpgzq+imwN2u5mBAHdhJAyyVYr5NTys hL/g== 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=6nvwrdwFQFfVWryhozrzfX48ubzoceWz0iZ+FUQS5OE=; b=SFEWJ7Puy2fB3DYojDzpud450NNPrHsf/PZkzskY5LyETxN/MFhXmsEHRDFPPEeoHg d35sFIVu5IpMfr7VpvSshBk8k4lNzBgcpW0fmsy1z6FWpiJefgWsBavdc4JXUAJxrSU/ aNWsjkLCqAYZYNGPIPO2RPr9y+ffWZcExMv07ek07Rha8Y/CwmQnaCiCBcVxj0SrXaIB d67Ykc4A6nZ0hLaMITWv2AxfgI0hRO0SLTwM+LIsMC/4CSxYuPt6a40QA5OZHGWfN1K4 yXvBk0U0qNTgq4eAwmM+YkwwRA1g5oGhvQhl9PFyqE3hQPFLkNMlthFgPXkjdYQfCZ5r SZNg== X-Gm-Message-State: AOAM530poYVYn7aM4jdjo6VPC5Yr/CIqKrCmHrgrytZmfWhjzovybck+ TN0ctkOgi4FJP++DwigZCBSNQNRmspa99g== X-Google-Smtp-Source: ABdhPJyvaUPXez0HtgFCAFd84L5FKGUl0mOLk3ApdiGP7egdp7DV5zdDRoJ18H0P+7eb9eU+szDKAQ== X-Received: by 2002:a7b:c191:: with SMTP id y17mr35920580wmi.19.1620640748581; Mon, 10 May 2021 02:59:08 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:e710:3ec:6dad:dc2]) by smtp.gmail.com with ESMTPSA id y17sm24767917wrw.90.2021.05.10.02.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 May 2021 02:59:08 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 10 May 2021 10:58:13 +0100 Message-Id: <20210510095814.3732400-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510095814.3732400-1-naush@raspberrypi.com> References: <20210510095814.3732400-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 4/6] ipa: raspberrypi: Add move/copy ctors and operators to Metadata class 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 default, move and copy constructor as well as a move operator implementation RPiController::Metadata class. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/controller/metadata.hpp | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/ipa/raspberrypi/controller/metadata.hpp b/src/ipa/raspberrypi/controller/metadata.hpp index e735cfbe0480..3a97a5f5c502 100644 --- a/src/ipa/raspberrypi/controller/metadata.hpp +++ b/src/ipa/raspberrypi/controller/metadata.hpp @@ -19,6 +19,21 @@ namespace RPiController { class Metadata { public: + Metadata() = default; + + Metadata(Metadata const &other) + { + std::scoped_lock other_lock(other.mutex_); + data_ = other.data_; + } + + Metadata(Metadata &&other) + { + std::scoped_lock other_lock(other.mutex_); + data_ = std::move(other.data_); + other.data_.clear(); + } + template void Set(std::string const &tag, T const &value) { @@ -50,6 +65,14 @@ public: return *this; } + Metadata &operator=(Metadata &&other) + { + std::scoped_lock lock(mutex_, other.mutex_); + data_ = std::move(other.data_); + other.data_.clear(); + return *this; + } + template T *GetLocked(std::string const &tag) {