From patchwork Sun Apr 18 09:04:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11976 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 84860BD812 for ; Sun, 18 Apr 2021 09:05:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 99B8068816; Sun, 18 Apr 2021 11:05:09 +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="fMsGmWtI"; dkim-atps=neutral Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DEB0068803 for ; Sun, 18 Apr 2021 11:05:06 +0200 (CEST) Received: by mail-ed1-x52d.google.com with SMTP id g17so36431839edm.6 for ; Sun, 18 Apr 2021 02:05:06 -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=fMsGmWtIYkreFvpGOwnQsQaU5u+qXC7mqSrY6XSMTX/9lqc7anbItR10Ed7ao9vYyK iX+QoNDaXQAlZB2uOg/R7gO7cKRmHBcwPkUphrrH9LAnKUEflV1L7P3B9KvTbk97A6ht F4Jzg8cidHeI4TWgym0SJSzwi2yqM+GsSPXIyKc21QzeXvAR9ydA+WxjHDRab2AmYhN+ N7JxrWmSJRykk/8NWqzPEpoJCgA29WPmTBWNZw3TU1GM0wtiIl/8maotwglEQ9wcAaDM YgJddHkWkTRfhzIGzO7rOrnqR6mbdrZL3Vnz8Z6Z9Z6z5LXobQdchXs7wlX2r8FlWpXR AZGQ== 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=HLTMUlsUBQJVqqJqvZ2NyXGE6VaVBFtOx0d3BlqTa+oepn87u50Y3n/8/XzyfuPQgH TUBC5F96BOmpQAR+Zw0y3cOv+thIpMMQtUkfpmBrRzSYSmyw22vhXDsBRLyz2P62ZgKB WqPplmknJjzYlxXFacjzh0sSg81XzHfaf8iEbxfQRCZTAK6Flkbb7lUAbxTmjTnYPlk+ h23/GtdEqBJe2qLf0a+cK1H/LNdDETaebyZcr2JSGNl7h8N3jplYkEuhyU4KbY99Yf33 hgLR7+jhiqfxQPnr8aQQJEJYYkWYpzujVF+xGkKwp9uKhnLeUX6qaYKOPP2nARJ+LS/P 3eHw== X-Gm-Message-State: AOAM533OddoLX+WHa1/qhj1GyjJJ7pXPXMgMX0fYuhV0RlCM7ztWMGHP pE4iFRkRmTQ5FEsOJougHnVfumL2i97S4A== X-Google-Smtp-Source: ABdhPJz7bIrSlqvxl1DSz4K0AoH4bjS2PtC9oEDz9udF4D/B7DgAMRKZ9WkJnKCW73ZWa8L4nKpG2g== X-Received: by 2002:aa7:c7cc:: with SMTP id o12mr19683388eds.291.1618736706365; Sun, 18 Apr 2021 02:05:06 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id z4sm9080679edb.97.2021.04.18.02.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Apr 2021 02:05:06 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Sun, 18 Apr 2021 10:04:58 +0100 Message-Id: <20210418090459.38506-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210418090459.38506-1-naush@raspberrypi.com> References: <20210418090459.38506-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/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) {