{"id":12003,"url":"https://patchwork.libcamera.org/api/1.1/patches/12003/?format=json","web_url":"https://patchwork.libcamera.org/patch/12003/","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":"<20210419133451.263733-3-naush@raspberrypi.com>","date":"2021-04-19T13:34:48","name":"[libcamera-devel,v5,2/5] ipa: raspberrypi: Reformat RPiController::Metadata class header","commit_ref":null,"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/12003/mbox/","series":[{"id":1950,"url":"https://patchwork.libcamera.org/api/1.1/series/1950/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1950","date":"2021-04-19T13:34:46","name":"ipa: raspberrypi: Rate-limit the controller algorithms","version":5,"mbox":"https://patchwork.libcamera.org/series/1950/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12003/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12003/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 E07B1BD814\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Apr 2021 13:35:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 30DC26883A;\n\tMon, 19 Apr 2021 15:35:03 +0200 (CEST)","from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AB3C768839\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Apr 2021 15:34:59 +0200 (CEST)","by mail-wr1-x434.google.com with SMTP id x7so34048542wrw.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Apr 2021 06:34:59 -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\tk11sm19952238wrx.88.2021.04.19.06.34.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 19 Apr 2021 06:34:58 -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=\"HTpYjrXy\"; 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=HTpYjrXyhOkDbT+U6Ji+AedTG+1SM/axFXnKyJdP/r6CiTmV4Lq7hVct9ymv0fRm7f\n\t6zBWk57jyTmPgUQIfLDLPAVUp8qvq86LQyW7FN9lHSwBUkPM2kaD2THo4vyUfADLxi7D\n\tXY7RSmJNyjzqjlpkgPj4kPVOfLHGqFacYrWKINg/7MeQGDSexlN2o630Axjn2QAnbUgk\n\tXg33RxSHlGs+vV7GujtQ51eXyzmoDNY58jwF0WPou9F2KF/YM+liff4cD+Nofk3CYEJ0\n\tm1HrBQrPdWzw+G5mEbbq5C4JSw+2nBICnBCtgENY6sneUG+uazBxqq07cV0++Ocimx2m\n\tZxUw==","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=J/YiAC81wE5AdgbcSTVjkPjEl8Q9ZwwmOOIYoTlX+4kgzOdhhcwJ6T8yhlw92Zapzx\n\t9eVl8sQE+ZtiPQO76mK3LtSXepxYh1BHQFGZX2mH6IOGDXjEUjxiiyBptzNK1OcghCRT\n\tBXfQ/qTYEve96iekWmjlYBtlezC8ceH0puQ1WtLTEDBSaF2R0ZNIbb5wnpE34zVQKHOn\n\tdpJxpvsbPrG6RVhsD5J6EHyjCWE6923CND05FdtpuYygIpMeM6SZrbtwlJwprYh+0/iw\n\tyBb2T4UqtOzGVAZUHfjtagbOT8r7Rt/KxHsIvPKm6JJrb12IGJoQ6PltvlceBYv2h+HX\n\tYorw==","X-Gm-Message-State":"AOAM533eRVXnFOAUnTZcoqP6wpU8yG2yW2jndsqEgLtgpEpji6EDcemK\n\tawbsqrA18KJO7SRwdkft0b3Uzdwrg2QPnA==","X-Google-Smtp-Source":"ABdhPJwfiE/OqWMwEZwwOCxP722thno8kdHcAqn3gr8RrxsrlnOA/Kt8nV+7AvecJk9EmusgvwTBdQ==","X-Received":"by 2002:a05:6000:362:: with SMTP id\n\tf2mr14730584wrf.141.1618839299060; \n\tMon, 19 Apr 2021 06:34:59 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 19 Apr 2021 14:34:48 +0100","Message-Id":"<20210419133451.263733-3-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210419133451.263733-1-naush@raspberrypi.com>","References":"<20210419133451.263733-1-naush@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v5 2/5] 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","v5","2/5"]}