| Message ID | 20260113000808.15395-26-laurent.pinchart@ideasonboard.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
2026. 01. 13. 1:07 keltezéssel, Laurent Pinchart írta: > The new constructor takes a value, allowing creation of a leaf ValueNode > with a value in a single operation instead of having to call set() on an > empty node. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > include/libcamera/internal/value_node.h | 7 +++++++ > src/libcamera/value_node.cpp | 7 +++++++ > 2 files changed, 14 insertions(+) > > diff --git a/include/libcamera/internal/value_node.h b/include/libcamera/internal/value_node.h > index a336c1d08e1c..eb509d855810 100644 > --- a/include/libcamera/internal/value_node.h > +++ b/include/libcamera/internal/value_node.h > @@ -143,6 +143,13 @@ public: > #endif /* __DOXYGEN__ */ > > ValueNode(); > + > + template<typename T> > + ValueNode(T &&value) > + { > + set(std::forward<T>(value)); > + } > + > ~ValueNode(); > > bool isValue() const > diff --git a/src/libcamera/value_node.cpp b/src/libcamera/value_node.cpp > index 7374e7bdde8c..b8f0c6d5cbc4 100644 > --- a/src/libcamera/value_node.cpp > +++ b/src/libcamera/value_node.cpp > @@ -44,6 +44,13 @@ ValueNode::ValueNode() > { > } > > +/** > + * \fn template<typename T> ValueNode::ValueNode(T &&value) > + * \brief Construct a ValueNode instance with a value > + * \tparam T Type of the value > + * \param[in] value The value > + */ > + > ValueNode::~ValueNode() = default; > > /**
diff --git a/include/libcamera/internal/value_node.h b/include/libcamera/internal/value_node.h index a336c1d08e1c..eb509d855810 100644 --- a/include/libcamera/internal/value_node.h +++ b/include/libcamera/internal/value_node.h @@ -143,6 +143,13 @@ public: #endif /* __DOXYGEN__ */ ValueNode(); + + template<typename T> + ValueNode(T &&value) + { + set(std::forward<T>(value)); + } + ~ValueNode(); bool isValue() const diff --git a/src/libcamera/value_node.cpp b/src/libcamera/value_node.cpp index 7374e7bdde8c..b8f0c6d5cbc4 100644 --- a/src/libcamera/value_node.cpp +++ b/src/libcamera/value_node.cpp @@ -44,6 +44,13 @@ ValueNode::ValueNode() { } +/** + * \fn template<typename T> ValueNode::ValueNode(T &&value) + * \brief Construct a ValueNode instance with a value + * \tparam T Type of the value + * \param[in] value The value + */ + ValueNode::~ValueNode() = default; /**
The new constructor takes a value, allowing creation of a leaf ValueNode with a value in a single operation instead of having to call set() on an empty node. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- include/libcamera/internal/value_node.h | 7 +++++++ src/libcamera/value_node.cpp | 7 +++++++ 2 files changed, 14 insertions(+)