[v3,31/37] libcamera: global_configuration: Drop Option type
diff mbox series

Message ID 20260423230059.3180987-32-laurent.pinchart@ideasonboard.com
State New
Headers show
Series
  • libcamera: Global configuration file improvements
Related show

Commit Message

Laurent Pinchart April 23, 2026, 11 p.m. UTC
The GlobalConfiguration::Option type was introduced to decouple the
configuration option storage from its users, and make changes to the
underlying implementation easier. While the type could indeed be changed
to map to a different class, the API would need to remain the same. The
Option type therefore brings little value. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
---
Changes since v2:

- Drop note from GlobalConfiguration::version() documentation
---
 include/libcamera/internal/global_configuration.h |  4 +---
 src/libcamera/global_configuration.cpp            | 15 ++-------------
 src/libcamera/pipeline/simple/simple.cpp          |  2 +-
 3 files changed, 4 insertions(+), 17 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/internal/global_configuration.h b/include/libcamera/internal/global_configuration.h
index 2c0bfadb4676..5eb646e33fc2 100644
--- a/include/libcamera/internal/global_configuration.h
+++ b/include/libcamera/internal/global_configuration.h
@@ -22,12 +22,10 @@  namespace libcamera {
 class GlobalConfiguration
 {
 public:
-	using Option = const ValueNode &;
-
 	GlobalConfiguration();
 
 	unsigned int version() const;
-	Option configuration() const;
+	const ValueNode &configuration() const;
 
 	template<typename T>
 	std::optional<T> option(
diff --git a/src/libcamera/global_configuration.cpp b/src/libcamera/global_configuration.cpp
index 4d154c026e44..a70562614b12 100644
--- a/src/libcamera/global_configuration.cpp
+++ b/src/libcamera/global_configuration.cpp
@@ -55,14 +55,6 @@  LOG_DEFINE_CATEGORY(Configuration)
  * options, or configuration() to access the whole configuration.
  */
 
-/**
- * \typedef GlobalConfiguration::Option
- * \brief Type representing a configuration option
- *
- * All code outside GlobalConfiguration must use this type declaration and not
- * the underlying type.
- */
-
 /**
  * \brief Initialize the global configuration
  */
@@ -153,12 +145,9 @@  unsigned int GlobalConfiguration::version() const
  * The requested part of the configuration can be accessed using \a ValueNode
  * methods.
  *
- * \note \a ValueNode type itself shouldn't be used in type declarations to
- * avoid trouble if we decide to change the underlying data objects in future.
- *
- * \return The top-level configuration option
+ * \return The global configuration
  */
-GlobalConfiguration::Option GlobalConfiguration::configuration() const
+const ValueNode &GlobalConfiguration::configuration() const
 {
 	return (*configuration_)["configuration"];
 }
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 0aa5b1c5255a..c6fe12d65b18 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -1880,7 +1880,7 @@  bool SimplePipelineHandler::matchDevice(std::shared_ptr<MediaDevice> media,
 
 	swIspEnabled_ = info.swIspEnabled;
 	const GlobalConfiguration &configuration = cameraManager()->_d()->configuration();
-	for (GlobalConfiguration::Option entry :
+	for (const ValueNode &entry :
 	     configuration.configuration()["pipelines"]["simple"]["supported_devices"]
 		     .asList()) {
 		auto name = entry["driver"].get<std::string>();