{"id":3999,"url":"https://patchwork.libcamera.org/api/1.1/patches/3999/?format=json","web_url":"https://patchwork.libcamera.org/patch/3999/","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":"<20200608232844.10150-5-jacopo@jmondi.org>","date":"2020-06-08T23:28:42","name":"[libcamera-devel,v2,4/6] libcamera: formats: Add ImageFormats::contain()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ae6bc49246b3ddfb788c945f9f235a86bdcb881e","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/1.1/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/3999/mbox/","series":[{"id":979,"url":"https://patchwork.libcamera.org/api/1.1/series/979/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=979","date":"2020-06-08T23:28:38","name":"ImageFormats, you again","version":2,"mbox":"https://patchwork.libcamera.org/series/979/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3999/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3999/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9BF4361687\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Jun 2020 01:25:27 +0200 (CEST)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id 0FB46240004;\n\tMon,  8 Jun 2020 23:25:26 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  9 Jun 2020 01:28:42 +0200","Message-Id":"<20200608232844.10150-5-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200608232844.10150-1-jacopo@jmondi.org>","References":"<20200608232844.10150-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 4/6] libcamera: formats: Add\n\tImageFormats::contain()","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>","X-List-Received-Date":"Mon, 08 Jun 2020 23:25:27 -0000"},"content":"Add a method to check if a format is part of the formats enumeration.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/formats.h |  1 +\n src/libcamera/formats.cpp            | 11 +++++++++++\n 2 files changed, 12 insertions(+)","diff":"diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\nindex cb840014cbd7..914fdde27d0c 100644\n--- a/include/libcamera/internal/formats.h\n+++ b/include/libcamera/internal/formats.h\n@@ -33,6 +33,7 @@ public:\n \tint addFormat(T format, const std::vector<SizeRange> &sizes);\n \n \tbool isEmpty() const;\n+\tbool contains(T format) const;\n \tstd::vector<T> formats() const;\n \tconst std::vector<SizeRange> &sizes(T format) const;\n \tconst std::map<T, std::vector<SizeRange>> &data() const;\ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex fe50b9aaa1f2..9f46f82c9059 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -99,6 +99,17 @@ bool ImageFormats<T>::isEmpty() const\n \treturn data_.empty();\n }\n \n+/**\n+ * \\brief Check if the formats enumeration contains \\a format\n+ * \\param[in] format The format\n+ * \\return True if the enumeration contains such format, false otherwise\n+ */\n+template<typename T>\n+bool ImageFormats<T>::contains(T format) const\n+{\n+\treturn data_.find(format) == data_.end();\n+}\n+\n /**\n  * \\brief Retrieve a list of all supported image formats\n  * \\return List of pixel formats or media bus codes\n","prefixes":["libcamera-devel","v2","4/6"]}