{"id":12235,"url":"https://patchwork.libcamera.org/api/1.1/patches/12235/?format=json","web_url":"https://patchwork.libcamera.org/patch/12235/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210510095814.3732400-3-naush@raspberrypi.com>","date":"2021-05-10T09:58:11","name":"[libcamera-devel,v6,2/6] ipa: raspberrypi: Reformat RPiController::Metadata class header","commit_ref":"340477f987f13c7e02b8848b190c6ef75608f6e8","pull_url":null,"state":"accepted","archived":false,"hash":"2ccb47bd8deeedeeab1a54582b73be1c604db0d6","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12235/mbox/","series":[{"id":2015,"url":"https://patchwork.libcamera.org/api/1.1/series/2015/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2015","date":"2021-05-10T09:58:09","name":"ipa: raspberrypi: Rate-limit the controller algorithms","version":6,"mbox":"https://patchwork.libcamera.org/series/2015/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12235/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12235/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 34BC4BF829\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 10 May 2021 09:59:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EB68A6891D;\n\tMon, 10 May 2021 11:59:11 +0200 (CEST)","from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7DAEC6891A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 May 2021 11:59:07 +0200 (CEST)","by mail-wm1-x334.google.com with SMTP id\n\tu5-20020a7bc0450000b02901480e40338bso9362436wmc.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 May 2021 02:59:07 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:e710:3ec:6dad:dc2])\n\tby smtp.gmail.com with ESMTPSA id\n\ty17sm24767917wrw.90.2021.05.10.02.59.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 10 May 2021 02:59:06 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"pU5bzADc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=+GT3G4sPCrq9a5bQt/xmz9z6Jx7t87Z5yxPlBQqFaZM=;\n\tb=pU5bzADcJMPLNrBVQ07r1tDtIXwyVlPYDEWKokZedo0ouvLGZ3bTmsb3YVO11QoDY3\n\tX58wwRE/r9MgA9Wr3BAd5NK+qg/3sV//9PliyK1hYOPDT8q1ARgCpK1YI8wlrkJrAZ29\n\tgLzicwCYmOHt/Hk2C1xmGIdykjtHI9brjWCXwnq52r9YK7JfpMotoyeS5Rrz35JOGVoZ\n\tv1fPpYc7gFT6kUqezUF3/AyDaBv8ZFKwbgQMS3G4Umzb0nOA5+qJnSYit+wo11dVdb0Q\n\tkQBvZ1rSdutY9sKZDqAGtftzBQiKxyFVcTaslBxpuZNJnBVX/IkWkuuUu01pET2NKagn\n\t3JEA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=+GT3G4sPCrq9a5bQt/xmz9z6Jx7t87Z5yxPlBQqFaZM=;\n\tb=Ub6LGCJr17gq9kp2Pis7VfbQbnhcipaaBXTlB6spe96z992ODTjKvmb/j9jqp0xZYu\n\tozCXt7VdZFL1bgEiE90gDkQmDr3vtp3jKr9HjvG1VZ4QSB80xjRXGkF2/fgJeZM5P+Ra\n\t3V5EmLf+9iroqnimxYzkwtpZDJEoBSWwuXfAt07WewPd5V7FxE7wjIlJwaLbmmyAAMPN\n\tKntzgvUuS87870s/3zo7jNHdrdw8PO3ENYfdS3BOMKS4RszYBq/7snDtlz/ijMSodNmN\n\tFUibnbydjoZFEWM7+FLJovBBSttYLJrYtf1ejzbcyjUzbngC28ZyWQPsalYTXm+Jmnii\n\tYjIg==","X-Gm-Message-State":"AOAM533PFEoYcu/48axWqJONQY56qPej7dM1MAIl9sBftmoOd2CbrTK3\n\tiy2C1ETJ22eNygYwHI3nFdy9etMPgLnKLw==","X-Google-Smtp-Source":"ABdhPJza/+EbCU2q1b2BJALltEDucDymYtxq9wpHsHgsJ8fA1zgIpYYyz3FQbS1tNWEgyomKlLlqjQ==","X-Received":"by 2002:a05:600c:4105:: with SMTP id\n\tj5mr36197475wmi.141.1620640746976; \n\tMon, 10 May 2021 02:59:06 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 10 May 2021 10:58:11 +0100","Message-Id":"<20210510095814.3732400-3-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 2/6] ipa: raspberrypi: Reformat\n\tRPiController::Metadata class header","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Rearrange header includes to be in alphabetical order.\nAdd whitespace to class definition to match libcamera coding guidelines.\nFix a typo in the comment showing an example of scoped locks.\n\nThere are no functional changes in this commit.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/raspberrypi/controller/metadata.hpp | 23 ++++++++++++++-------\n 1 file changed, 16 insertions(+), 7 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/metadata.hpp b/src/ipa/raspberrypi/controller/metadata.hpp\nindex 4f44ffc6771c..07dd28ed9e0a 100644\n--- a/src/ipa/raspberrypi/controller/metadata.hpp\n+++ b/src/ipa/raspberrypi/controller/metadata.hpp\n@@ -1,6 +1,6 @@\n /* SPDX-License-Identifier: BSD-2-Clause */\n /*\n- * Copyright (C) 2019, Raspberry Pi (Trading) Limited\n+ * Copyright (C) 2019-2021, Raspberry Pi (Trading) Limited\n  *\n  * metadata.hpp - general metadata class\n  */\n@@ -9,22 +9,25 @@\n // A simple class for carrying arbitrary metadata, for example about an image.\n \n #include <any>\n-#include <string>\n-#include <mutex>\n #include <map>\n #include <memory>\n+#include <mutex>\n+#include <string>\n \n namespace RPiController {\n \n class Metadata\n {\n public:\n-\ttemplate<typename T> void Set(std::string const &tag, T const &value)\n+\ttemplate<typename T>\n+\tvoid Set(std::string const &tag, T const &value)\n \t{\n \t\tstd::lock_guard<std::mutex> lock(mutex_);\n \t\tdata_[tag] = value;\n \t}\n-\ttemplate<typename T> int Get(std::string const &tag, T &value) const\n+\n+\ttemplate<typename T>\n+\tint Get(std::string const &tag, T &value) const\n \t{\n \t\tstd::lock_guard<std::mutex> lock(mutex_);\n \t\tauto it = data_.find(tag);\n@@ -33,11 +36,13 @@ public:\n \t\tvalue = std::any_cast<T>(it->second);\n \t\treturn 0;\n \t}\n+\n \tvoid Clear()\n \t{\n \t\tstd::lock_guard<std::mutex> lock(mutex_);\n \t\tdata_.clear();\n \t}\n+\n \tMetadata &operator=(Metadata const &other)\n \t{\n \t\tstd::lock_guard<std::mutex> lock(mutex_);\n@@ -45,7 +50,9 @@ public:\n \t\tdata_ = other.data_;\n \t\treturn *this;\n \t}\n-\ttemplate<typename T> T *GetLocked(std::string const &tag)\n+\n+\ttemplate<typename T>\n+\tT *GetLocked(std::string const &tag)\n \t{\n \t\t// This allows in-place access to the Metadata contents,\n \t\t// for which you should be holding the lock.\n@@ -54,15 +61,17 @@ public:\n \t\t\treturn nullptr;\n \t\treturn std::any_cast<T>(&it->second);\n \t}\n+\n \ttemplate<typename T>\n \tvoid SetLocked(std::string const &tag, T const &value)\n \t{\n \t\t// Use this only if you're holding the lock yourself.\n \t\tdata_[tag] = value;\n \t}\n+\n \t// Note: use of (lowercase) lock and unlock means you can create scoped\n \t// locks with the standard lock classes.\n-\t// e.g. std::lock_guard<PisP::Metadata> lock(metadata)\n+\t// e.g. std::lock_guard<RPiController::Metadata> lock(metadata)\n \tvoid lock() { mutex_.lock(); }\n \tvoid unlock() { mutex_.unlock(); }\n \n","prefixes":["libcamera-devel","v6","2/6"]}