IOLink  IOL_v1.6.1_release
iolink::MetadataNodeHelper Class Reference

A collection of functions to handle paths on MetadataNode instances. More...

#include <iolink/metadata/MetadataNodeHelper.h>

Static Public Member Functions

static std::shared_ptr< const MetadataNodegetNode (std::shared_ptr< const MetadataNode > root, const std::string &path)
 Helper returning child node of given root node using a path. More...
 
static bool exists (std::shared_ptr< const MetadataNode > root, const std::string &path)
 Check if a path exists in the metadata tree. More...
 
static std::shared_ptr< const MetadataNodecreatePath (std::shared_ptr< MetadataNode > origin, const std::string &path, std::shared_ptr< VariantDataValue > value)
 Helper allowing to create the given path in given tree origin. More...
 

Detailed Description

A collection of functions to handle paths on MetadataNode instances.

Member Function Documentation

◆ createPath()

static std::shared_ptr<const MetadataNode> iolink::MetadataNodeHelper::createPath ( std::shared_ptr< MetadataNode origin,
const std::string &  path,
std::shared_ptr< VariantDataValue value 
)
static

Helper allowing to create the given path in given tree origin.

ex: /MRC/ext/pixelSize" or "MRC/ext/pixelSize" The method will only create missing nodes in given tree origin. If specified, the given value will be affected to last node of the given path ("pixelSize" in above example). If the whole path already exists, the last node will be overwritten with a created one containing given value.

Parameters
originnode from where the path must be created
pathpath to create
valuevalue to affect to the leaf of given path, null by default
Returns
the origin node

◆ exists()

static bool iolink::MetadataNodeHelper::exists ( std::shared_ptr< const MetadataNode root,
const std::string &  path 
)
static

Check if a path exists in the metadata tree.

Parameters
rootThe node from which to check the path.
pathThe path to test.

◆ getNode()

static std::shared_ptr<const MetadataNode> iolink::MetadataNodeHelper::getNode ( std::shared_ptr< const MetadataNode root,
const std::string &  path 
)
static

Helper returning child node of given root node using a path.

ex: "/MRC/ext/pixelSize"

The following paths are equivalent: "/MRC/ext/pixelSize", "MRC/ext/pixelSize", "\\MRC\\ext\\pixelSize" and "MRC\\ext\\pixelSize"

If child node doesn't exist, nullptr is returned.

Warning: Doesn't support wildcards or regexp.

Parameters
rootroot of metadata tree to parse
pathpath of nodes to follow to access to the searched one
Returns
searched child node if found (nullptr otherwise)

The documentation for this class was generated from the following file: