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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user