From patchwork Fri May 7 08:40:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12224 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 C585DBF835 for ; Fri, 7 May 2021 08:40:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0B4F868922; Fri, 7 May 2021 10:40:53 +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="JoMOA0q+"; dkim-atps=neutral Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 530846890C for ; Fri, 7 May 2021 10:40:51 +0200 (CEST) Received: by mail-wr1-x42f.google.com with SMTP id d11so8307286wrw.8 for ; Fri, 07 May 2021 01:40:51 -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=xuoCbVuKUIV66V4sgaGGY+s1zJ8EKg0r9sGPnJwPd7c=; b=JoMOA0q+PdyiE4YVl796UrAGS+2B2MCT6G659h5Y9JQllK7wwu50ZQ5LbBEA1MFUxI le3qVa72nNCbyn47DrqfuuMEIi+Mxq02ah1yabFJAjyAwAbVbdgW+KTFPNSJ8VyBv9tA XnnJE7TX/xYlsFtOzOxAMqtL51+m/cv1bLB+AccWyxeFKPlwgeypzLg/VJztHL/a6WQP NTmCDWOAnh2GrSXoTgTuNjh229oZtqFfk0yT/FMCClBeTf8YKsXtODq5Ppcekyl4U72F nbHA6FcNMf0S5pdpsQolVr6oH0IP7wwdFIMl4bYV5vUlnskEJ9P71RrBeufT4/Uuksia HNlA== 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=xuoCbVuKUIV66V4sgaGGY+s1zJ8EKg0r9sGPnJwPd7c=; b=D+5LUYZ5epSJ1wDdKCk7DJgK3/DiyMrGrSuvlbUBBQTOf/sEl4iNTdDe6z/xhOZGKP jOljqRZ3Q0KuAEhtRad468cM6k+nGAoMS9Yd4kSl9wA4RKlLdQO3Lav9yEvknKwovEel vkGIj95z41Yh6BZYg92BHU6dWob8LsS4NpYmEp0iJRQtm2loExKeHq4Ikz0pg5PkEiIT owXGQLcyIra13236/u5/YJ/YKVHBBLIZn1o3ZcxaDjZ/BsgnxiC6l3XN0tT0T5Knz2K5 IM84NBBM2mKaCAcP70orIG2DoPjJmvw/xasPpoP66U+KvTh7umzXFNmkRlAHp8QvrAHc WzXg== X-Gm-Message-State: AOAM531LtKZSQOIHQq9ZUoo4o/gcrzjS8irMfFy1u3o7NWFM4oSa0Aa9 5+3zYWt51j0OYAhRo+hxXHlrCCstOt71cA== X-Google-Smtp-Source: ABdhPJxF7gsr2QgV7o+ADEQAJDXCWQXpHMvJjxaghHunRJnLFYdb8p4KCUM1RjBFkLVPVBnEulJ0XA== X-Received: by 2002:adf:d084:: with SMTP id y4mr10946207wrh.0.1620376850628; Fri, 07 May 2021 01:40:50 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:81ab:95ee:9715:e9fb]) by smtp.gmail.com with ESMTPSA id l12sm7604098wrm.76.2021.05.07.01.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 01:40:50 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 7 May 2021 09:40:40 +0100 Message-Id: <20210507084042.31879-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210507084042.31879-1-naush@raspberrypi.com> References: <20210507084042.31879-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 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) {