[{"id":33327,"web_url":"https://patchwork.libcamera.org/comment/33327/","msgid":"<173926701133.2293020.17328474173312048208@ping.linuxembedded.co.uk>","date":"2025-02-11T09:43:31","subject":"Re: [PATCH 2/4] libcamera: Adapt Vector class to new location","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-02-06 14:10:09)\n> Change the namespace of the Vector class from libipa to libcamera and\n> add it to the build.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  include/libcamera/internal/meson.build |  1 +\n>  include/libcamera/internal/vector.h    | 14 +++++---------\n>  src/libcamera/meson.build              |  1 +\n>  src/libcamera/vector.cpp               |  6 +-----\n>  test/meson.build                       |  1 +\n>  test/vector.cpp                        |  4 ++--\n>  6 files changed, 11 insertions(+), 16 deletions(-)\n> \n> diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\n> index 7d6aa8b72bd7..45408b313848 100644\n> --- a/include/libcamera/internal/meson.build\n> +++ b/include/libcamera/internal/meson.build\n> @@ -43,6 +43,7 @@ libcamera_internal_headers = files([\n>      'v4l2_pixelformat.h',\n>      'v4l2_subdevice.h',\n>      'v4l2_videodevice.h',\n> +    'vector.h',\n>      'yaml_parser.h',\n>  ])\n>  \n> diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h\n> index fe33c9d6fbd1..a67a09474204 100644\n> --- a/include/libcamera/internal/vector.h\n> +++ b/include/libcamera/internal/vector.h\n> @@ -24,8 +24,6 @@ namespace libcamera {\n>  \n>  LOG_DECLARE_CATEGORY(Vector)\n>  \n> -namespace ipa {\n> -\n>  #ifndef __DOXYGEN__\n>  template<typename T, unsigned int Rows,\n>          std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>\n> @@ -329,11 +327,9 @@ bool operator!=(const Vector<T, Rows> &lhs, const Vector<T, Rows> &rhs)\n>  bool vectorValidateYaml(const YamlObject &obj, unsigned int size);\n>  #endif /* __DOXYGEN__ */\n>  \n> -} /* namespace ipa */\n> -\n>  #ifndef __DOXYGEN__\n>  template<typename T, unsigned int Rows>\n> -std::ostream &operator<<(std::ostream &out, const ipa::Vector<T, Rows> &v)\n> +std::ostream &operator<<(std::ostream &out, const Vector<T, Rows> &v)\n>  {\n>         out << \"Vector { \";\n>         for (unsigned int i = 0; i < Rows; i++) {\n> @@ -346,13 +342,13 @@ std::ostream &operator<<(std::ostream &out, const ipa::Vector<T, Rows> &v)\n>  }\n>  \n>  template<typename T, unsigned int Rows>\n> -struct YamlObject::Getter<ipa::Vector<T, Rows>> {\n> -       std::optional<ipa::Vector<T, Rows>> get(const YamlObject &obj) const\n> +struct YamlObject::Getter<Vector<T, Rows>> {\n> +       std::optional<Vector<T, Rows>> get(const YamlObject &obj) const\n>         {\n> -               if (!ipa::vectorValidateYaml(obj, Rows))\n> +               if (!vectorValidateYaml(obj, Rows))\n>                         return std::nullopt;\n>  \n> -               ipa::Vector<T, Rows> vector;\n> +               Vector<T, Rows> vector;\n>  \n>                 unsigned int i = 0;\n>                 for (const YamlObject &entry : obj.asList()) {\n> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> index 57fde8a8fab0..de22b8e60dde 100644\n> --- a/src/libcamera/meson.build\n> +++ b/src/libcamera/meson.build\n> @@ -53,6 +53,7 @@ libcamera_internal_sources = files([\n>      'v4l2_pixelformat.cpp',\n>      'v4l2_subdevice.cpp',\n>      'v4l2_videodevice.cpp',\n> +    'vector.cpp',\n>      'yaml_parser.cpp',\n>  ])\n>  \n> diff --git a/src/libcamera/vector.cpp b/src/libcamera/vector.cpp\n> index 8019f8cfdc85..85ca2208245a 100644\n> --- a/src/libcamera/vector.cpp\n> +++ b/src/libcamera/vector.cpp\n> @@ -5,7 +5,7 @@\n>   * Vector and related operations\n>   */\n>  \n> -#include \"vector.h\"\n> +#include \"libcamera/internal/vector.h\"\n>  \n>  #include <libcamera/base/log.h>\n>  \n> @@ -18,8 +18,6 @@ namespace libcamera {\n>  \n>  LOG_DEFINE_CATEGORY(Vector)\n>  \n> -namespace ipa {\n> -\n>  /**\n>   * \\class Vector\n>   * \\brief Vector class\n> @@ -346,6 +344,4 @@ bool vectorValidateYaml(const YamlObject &obj, unsigned int size)\n>  }\n>  #endif /* __DOXYGEN__ */\n>  \n> -} /* namespace ipa */\n> -\n>  } /* namespace libcamera */\n> diff --git a/test/meson.build b/test/meson.build\n> index 5ed052ed62c8..4095664994fd 100644\n> --- a/test/meson.build\n> +++ b/test/meson.build\n> @@ -73,6 +73,7 @@ internal_tests = [\n>      {'name': 'timer-thread', 'sources': ['timer-thread.cpp']},\n>      {'name': 'unique-fd', 'sources': ['unique-fd.cpp']},\n>      {'name': 'utils', 'sources': ['utils.cpp']},\n> +    {'name': 'vector', 'sources': ['vector.cpp']},\n>      {'name': 'yaml-parser', 'sources': ['yaml-parser.cpp']},\n>  ]\n>  \n> diff --git a/test/vector.cpp b/test/vector.cpp\n> index 8e4ec77d7820..4fae960defc1 100644\n> --- a/test/vector.cpp\n> +++ b/test/vector.cpp\n> @@ -5,14 +5,14 @@\n>   * Vector tests\n>   */\n>  \n> -#include \"../src/ipa/libipa/vector.h\"\n> +#include \"libcamera/internal/vector.h\"\n>  \n>  #include <cmath>\n>  #include <iostream>\n>  \n>  #include \"test.h\"\n>  \n> -using namespace libcamera::ipa;\n> +using namespace libcamera;\n>  \n>  #define ASSERT_EQ(a, b)                                                        \\\n>  if ((a) != (b)) {                                                      \\\n> -- \n> 2.43.0\n>","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 1F5E7C32F5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Feb 2025 09:43:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E981C6861B;\n\tTue, 11 Feb 2025 10:43:35 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C7DB61865\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Feb 2025 10:43:34 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 366F42B3;\n\tTue, 11 Feb 2025 10:42:17 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"qL5xxyud\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1739266937;\n\tbh=sfj/wP2HQ91MofbUiHO8Jlfh9nuECvJYLZQHYkTVjbA=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=qL5xxyud5NVxTJZvmQ55zpfhLXjlqby7Cxk80ijFDGbACmt/Idq/bH9n9hSFOkdu0\n\tmUI4+l5qvxjblAqd3DAKPMBj/wk3p38GrXrxokC4xk49vYw63WC+6gXB2o9w10DR2t\n\tGypoMejSgoh/wPnUOotrkqFseA55/887cIjQTpyQ=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250206141018.236272-3-stefan.klug@ideasonboard.com>","References":"<20250206141018.236272-1-stefan.klug@ideasonboard.com>\n\t<20250206141018.236272-3-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH 2/4] libcamera: Adapt Vector class to new location","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 11 Feb 2025 09:43:31 +0000","Message-ID":"<173926701133.2293020.17328474173312048208@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]