From patchwork Mon Apr 19 13:17: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: 11998 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 28442BD812 for ; Mon, 19 Apr 2021 13:17:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D8FDA6883A; Mon, 19 Apr 2021 15:17:30 +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="pXhytwhM"; dkim-atps=neutral Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 64E7A68832 for ; Mon, 19 Apr 2021 15:17:28 +0200 (CEST) Received: by mail-wm1-x32f.google.com with SMTP id u5-20020a7bcb050000b029010e9316b9d5so18036300wmj.2 for ; Mon, 19 Apr 2021 06:17:28 -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=pXhytwhMwyQIX3nWdamPkvoIqD0AbWoGpvXKKLSV/DxJwpA1dRlxMw5MrTIBibxC00 /s+IFEvSnKJLrAaL8epKrRr17kA7DovWiiUWj+6YpCKFUcT2B9fuiBX0u3H5ctX9C7vI GzLQjjD5IDeeFSWmzNYgh8tYpL7wOnTFznuXw50TKN5KZveAXFJyJ3AlvKYFvxYiqWFQ rNuZcWpZjjx2Zp32DfPehfrhQ39xjaV+19wVx/8AzcUqCuvgT2n9hKMRdotJYLp3PbwJ eh59dxyjm5qh+uWQoBrAfXfp0NjYJAEj/L0ikdJqiIWLpERVsKbQ7EZkQ+MLjEgpK8OB nG1g== 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=IEF+bo5ogvTlRw9YV+07H3ky1Btp4+swsNV+kLCI5KJdm4b8nUuxRgBdILD5gkK9Cq MNMJ/+xDQ3OI6/AMcEndX/l0cErhFkFGAlnX9TWj2A9Z7IMuqJFJDKswMUnOrqG2E1J0 cKrbxmLc0/8B/tepSlwYyIxIzFaKKDKS1OcaMOZAMBtQrYDiZm2Zknuu7OS10EIloYGW jBiNIFk/9/tRNYiWKCeQTtny0GxRf4YGtta90GGC66edYRpd5LDw/7fvDgOoEN1ML5tK nsmH2FSMuxI5QNaYJAwqDKh1uw8C/FFnofvLWeK2dP4sAZ3E1OJfA0W7VnoErGmTSrg5 5TEg== X-Gm-Message-State: AOAM531NQn0lm7OIyQWPpn1PqCiFU0hQ4gyAjtu/IN6lHpxO8HH0/bhv oFSKlmiz2a4iK6C10kENS7rVaqsTV5OK0g== X-Google-Smtp-Source: ABdhPJw4Htvh4BmJIiVVLDFnHD1FqJY+0W3OTKM4HQ6JfyjoT7eSFMavDxokI8x0LXa+FCrRsulAcg== X-Received: by 2002:a1c:770a:: with SMTP id t10mr21872473wmi.49.1618838247855; Mon, 19 Apr 2021 06:17:27 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 06:17:27 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 19 Apr 2021 14:17:13 +0100 Message-Id: <20210419131715.256802-3-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 2/4] 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 --- 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) {