From patchwork Mon Apr 19 13:34:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12004 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 1A494BD814 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 0D38968838; 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="twneBOGw"; dkim-atps=neutral Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 605D568831 for ; Mon, 19 Apr 2021 15:35:00 +0200 (CEST) Received: by mail-wr1-x430.google.com with SMTP id e7so25105049wrs.11 for ; Mon, 19 Apr 2021 06:35:00 -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=uule6aP/GbUVKt6rRXc2oaEhZT9hc7570Iq0GDDxCU0=; b=twneBOGwzAW6ATxXHmLh5kVFuslumGQSPeQiZNUZUlAlluH3tIO80UXF+YXtKp1eBc yCat/cic8oUgc+Vih1CLVAFoxVAbLz4PCe8lLx7Azu16rp/7qVeAcj2KFnRPtK1+eAHv exvjLCnTG2Qv8DfYavdhKVhKOmhZzEZZJImFJR1tcEw980mEU+JnFOB2rN9wGbL2fXZY a3elDZ6aYw7js55k/9bimiulsD6VXNOeAfjCndMSSHjgehCTkUtZF+k/z0QR0iPOe5+6 EWUBCsBPPvZQM0XfKApMcEAxcXvYEU0zRQMJYlk2KBaU18mBIPs32ZFGAZyVdPSiWS6b 0Law== 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=uule6aP/GbUVKt6rRXc2oaEhZT9hc7570Iq0GDDxCU0=; b=DINRsNuKvbduT0uGvf+aQ1w23290fVkaJwW5CIWiVdQoGAJgK8kFh9Kua/GGuUZWsa JlmdzSlQpdWs1kZZLYa4Inx1lh3j5FR6chEOd1pIjqsNdU9dwwESwqRt+KY0JsoWWQDE kNNe8BhxicLzA1BVEtTgIc1DoexLkfUGbgsPDxML2jolpSQISss6hM/ugJ47xxxAPejo Y7AH1WtvaOFRQybX2svvWl3QTsg75u7xIncYeNvLVQX1WB+ZZAsSHyRAgeXUX65yANZm ZLPQZn3eBNOWdJF66LFjYCssg1aLsYLMUfBrjEpN1YgantLg5vUosAvpl2nxi8TUZuwZ dUig== X-Gm-Message-State: AOAM532rG6/a4q8e+ZiK6nAdVnz/yMPZVspuL/CQTuYPLq+469PK2d4q LBVybXxLZWpAxXfX28ogSgHUkt/FrMXDOg== X-Google-Smtp-Source: ABdhPJx1NoO+ncIMBrSHFR8zMHfq2NsCVthKEM7NodhWlvbE1Y4uFg4lV5t0IncBzm1MEiPva3EJZA== X-Received: by 2002:adf:c587:: with SMTP id m7mr14286722wrg.369.1618839299867; Mon, 19 Apr 2021 06:34:59 -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:34:59 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 19 Apr 2021 14:34:49 +0100 Message-Id: <20210419133451.263733-4-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 3/5] 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 | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/ipa/raspberrypi/controller/metadata.hpp b/src/ipa/raspberrypi/controller/metadata.hpp index 07dd28ed9e0a..319f2320fc70 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::lock_guard other_lock(other.mutex_); + data_ = other.data_; + } + + Metadata(Metadata &&other) + { + std::lock_guard other_lock(other.mutex_); + data_ = std::move(other.data_); + other.data_.clear(); + } + template void Set(std::string const &tag, T const &value) { @@ -51,6 +66,15 @@ public: return *this; } + Metadata &operator=(Metadata &&other) + { + std::lock_guard lock(mutex_); + std::lock_guard other_lock(other.mutex_); + data_ = std::move(other.data_); + other.data_.clear(); + return *this; + } + template T *GetLocked(std::string const &tag) {