libcamera: value_node: Add constructor with value

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>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2025-10-28 17:56:44 +02:00
parent 554c5c7fa1
commit 7f854199a3
2 changed files with 15 additions and 0 deletions

View File

@@ -143,6 +143,14 @@ public:
#endif /* __DOXYGEN__ */
ValueNode();
template<typename T>
ValueNode(T &&value)
: type_(Type::Empty)
{
set(std::forward<T>(value));
}
~ValueNode();
bool isValue() const

View File

@@ -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;
/**