{"id":11975,"url":"https://patchwork.libcamera.org/api/1.1/patches/11975/?format=json","web_url":"https://patchwork.libcamera.org/patch/11975/","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":"<20210418090459.38506-3-naush@raspberrypi.com>","date":"2021-04-18T09:04:57","name":"[libcamera-devel,v3,2/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/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11975/mbox/","series":[{"id":1944,"url":"https://patchwork.libcamera.org/api/1.1/series/1944/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1944","date":"2021-04-18T09:04:55","name":"ipa: raspberrypi: Rate-limit the controller algorithms","version":3,"mbox":"https://patchwork.libcamera.org/series/1944/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11975/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11975/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 C6012BD812\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 18 Apr 2021 09:05:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5ED0968803;\n\tSun, 18 Apr 2021 11:05:08 +0200 (CEST)","from mail-ed1-x531.google.com (mail-ed1-x531.google.com\n\t[IPv6:2a00:1450:4864:20::531])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2B428602CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 18 Apr 2021 11:05:06 +0200 (CEST)","by mail-ed1-x531.google.com with SMTP id j7so220519eds.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 18 Apr 2021 02:05:06 -0700 (PDT)","from naush-laptop.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tz4sm9080679edb.97.2021.04.18.02.05.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 18 Apr 2021 02:05:05 -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=\"bA2Iim9s\"; 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=bA2Iim9s4Yb7uN7Ca+qtkQm3I9YqirW0xuD49Vmz7IsgGBClVowaUCx6aDSIqW5VyX\n\tKaKQ6LE8kMkeiLjuEk6J1dS4wk4KdA/EYmFRdgn+t8a/oD2tY4VYFaqLBnb4d26qswLr\n\th9uIYtRR7Uz6EtATbHSxwG2J0Mq3pu2ClHMLtPrwQWGkpFWgW+m9VEIbps2HV8e3HRaA\n\tmzWscyHXaqY4a0H67TKsM/+1y4mFJ9ICsE9qv+B24toVSHN3lJVP5AFHtplsA0yhoO6B\n\to3q0z5LcpDyyX59iUSG0sJ9VXq4DR+swPUyvOggtkWqZXfHgVQ6UrME94IXF2yCa9t66\n\tVIYw==","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=jGmJg1URKJNHWb30JLTQrYr9jfWk9UjPxDXAkmf9Bxs3K18VLvzD+WA3XveTjCzBi/\n\tAzRoPN5rbgcGBpj9ykbtdi58dNtZlxuRFAVLOA3xDp0LthiETt2ztkwG/A/TQiwzy/8X\n\tBmFTxLqkV0bmFSTcgHmI97AdgvTzLFymOW5iFiSl9llNyTzGtTqZOTPWGGBU7ulbAgPY\n\tIrHiQHtnF6rJ/fyROwq+Mtt0+V1SLR9KohjJHt0q/mGL77U73UIWoTgGEQb4IRmkc1+K\n\tcIpzdSy3a/cd7fVZhI0soTU5NxuGIbr2cNCJuT56bDMhjnGPapfW44+db3vMPKOvs9uG\n\tNl7A==","X-Gm-Message-State":"AOAM530XZggQiePrFrsN8cVnXGTBN0kgVcC+j6xE1cFnE2yanNDNH7Bw\n\tH+VL9m1hgfy+IwGs/enrG404YXH9OVm3lg==","X-Google-Smtp-Source":"ABdhPJyb92kDm7+ciU2aoPFJs2W8m7d96CRVk7Zy9pmcANTRGbc1sUpe10xfK/BnyM59jSqUXeAF4g==","X-Received":"by 2002:a05:6402:4244:: with SMTP id\n\tg4mr19384023edb.204.1618736705513; \n\tSun, 18 Apr 2021 02:05:05 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun, 18 Apr 2021 10:04:57 +0100","Message-Id":"<20210418090459.38506-3-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 2/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","v3","2/4"]}