{"id":11997,"url":"https://patchwork.libcamera.org/api/patches/11997/?format=json","web_url":"https://patchwork.libcamera.org/patch/11997/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210419131715.256802-2-naush@raspberrypi.com>","date":"2021-04-19T13:17:12","name":"[libcamera-devel,v4,1/4] ipa: raspberrypi: Reformat RPiController::Metadata class header","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"2ccb47bd8deeedeeab1a54582b73be1c604db0d6","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11997/mbox/","series":[{"id":1949,"url":"https://patchwork.libcamera.org/api/series/1949/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1949","date":"2021-04-19T13:17:11","name":"ipa: raspberrypi: Rate-limit the controller algorithms","version":4,"mbox":"https://patchwork.libcamera.org/series/1949/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11997/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11997/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 C458EBD812\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Apr 2021 13:17:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 708C668835;\n\tMon, 19 Apr 2021 15:17:28 +0200 (CEST)","from mail-wr1-x435.google.com (mail-wr1-x435.google.com\n\t[IPv6:2a00:1450:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 756EB602CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Apr 2021 15:17:27 +0200 (CEST)","by mail-wr1-x435.google.com with SMTP id a4so34021901wrr.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Apr 2021 06:17:27 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:15:5363:8f56:4f84:754])\n\tby smtp.gmail.com with ESMTPSA id\n\tt6sm22335428wrx.38.2021.04.19.06.17.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 19 Apr 2021 06:17:26 -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=\"nnqfLFO4\"; 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=fW/hur3tefpJwBCdBS9ucikdtiTjIrz8a6UkMMoW9n0=;\n\tb=nnqfLFO4CanlAnfby2OO53IS4oy8LHMuHV0KuoyM+qsw8kt2/7PCogJexNoZG1UJ/S\n\te131S2qvyM242rJfoqDHf3Li7UusHy5yhXN+5JKMlMI5zOmzOB6e86t4Ov71gzYq/IV9\n\t4AVuvOq5/s8HoEE9JufuvyH1WIRTdOuVawS/tprbSfzuJeYqUKyqpB0RrjhK3eaaxuL7\n\tH9omSE4avIlvzFvdejf0QEz0xDQe7+yFPrVPegSh7vvBmQ439V2kme2eGkt95hmcNnxX\n\t3XPzqlKI6VNLYQ3hd8cWTz/+M7n7eW9QxLPUklaxkcuRCoWXYa6SVz5vx+qo4kW2YHMo\n\tSBhA==","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=fW/hur3tefpJwBCdBS9ucikdtiTjIrz8a6UkMMoW9n0=;\n\tb=ElILAxcDXubHXi+cbklVlV2bPdYfZtSknPmwPIUmtdmcsKefqYeAZD4rmNQ/RUzuei\n\tb4JKFca3aQhq6gs99TJqMADQBMcPQpxzcIvEOb0p1g/NcugigfszqI0sQnu3aW/fyZQi\n\taJ+nv6WnrXXnE8yVi+r4UjpygJex79jT0UMfq4JM0MuUR20gIyLRZR9ndCOouYGK9VKR\n\t/Ywgw+Bl7c8tapP7L1yTrq8RSrUZN+fuVHHMtmdVvg2LzdhOw7K9UaDpSOprNsjFJhB9\n\tdx47yNf2eHY4OihyNkB6uBRnVLq4B/yCu3WS9HErxKIsnYhELSBP2YUhgOzgIWwSabAM\n\tL02A==","X-Gm-Message-State":"AOAM533cTs/HatNEKRbxENdcb5CHIzBLyrGcYz1AoU70mhuyG+BqwaG0\n\tm+3AL9MktLffgAKjUsIw9RCFiZqdfdI1CQ==","X-Google-Smtp-Source":"ABdhPJxzUWyUfxq2BtVkx+BMOFZ8UN8rP1fxWrCb5hLDDf8o6B6aCpMaAbzSBuuGIDkQEPAmJhUQYg==","X-Received":"by 2002:adf:e58f:: with SMTP id\n\tl15mr14215503wrm.175.1618838246972; \n\tMon, 19 Apr 2021 06:17:26 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 19 Apr 2021 14:17:12 +0100","Message-Id":"<20210419131715.256802-2-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 1/4] 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>\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","v4","1/4"]}