Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::NodeReference< NodeType > Class Template Reference

Provides functionality for a reference to any attached node that you can access using a relative path. More...

#include <kanzi/core.ui/node/node_reference.hpp>

Inheritance diagram for kanzi::NodeReference< NodeType >:
[legend]

Public Types

typedef shared_ptr< NodeType > NodeTypeSharedPtr
 
typedef weak_ptr< NodeType > NodeTypeWeakPtr
 

Public Member Functions

void attach () override
 Attaches a node reference. More...
 
void detach () override
 Detaches a node reference. More...
 
NodeTypeSharedPtr get () const
 Returns the referenced node. More...
 
 NodeReference (Node &baseNode, const PropertyType< string > &propertyType)
 Constructor. More...
 
void setUserReference (NodeTypeSharedPtr node)
 Sets the node reference to refer to a node. More...
 
void update () override
 Refreshes a node reference. More...
 
virtual ~NodeReference ()
 Destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from kanzi::AbstractNodeReference
 ~AbstractNodeReference ()
 

Detailed Description

template<typename NodeType>
class kanzi::NodeReference< NodeType >

Provides functionality for a reference to any attached node that you can access using a relative path.

Kanzi installs the node reference on a base node. Kanzi then starts the look-up from the path that it retrieves from a property in the base node that you set in the NodeReference function. This path is relative to the base node.

You can override the look-up by assigning user reference node, in which case, Kanzi always returns the assigned node, and does not perform a look-up.

Member Typedef Documentation

template<typename NodeType>
typedef shared_ptr<NodeType> kanzi::NodeReference< NodeType >::NodeTypeSharedPtr
template<typename NodeType>
typedef weak_ptr<NodeType> kanzi::NodeReference< NodeType >::NodeTypeWeakPtr

Constructor & Destructor Documentation

template<typename NodeType>
kanzi::NodeReference< NodeType >::NodeReference ( Node baseNode,
const PropertyType< string > &  propertyType 
)
inlineexplicit

Constructor.

Parameters
baseNodeThe node where Kanzi installs the constructed node reference.
propertyTypeThe property of a baseNode the value of which Kanzi is using to resolve the referenced node.
template<typename NodeType>
virtual kanzi::NodeReference< NodeType >::~NodeReference ( )
inlinevirtual

Destructor.

Member Function Documentation

template<typename NodeType>
void kanzi::NodeReference< NodeType >::attach ( )
inlineoverridevirtual

Attaches a node reference.

Kanzi uses this reference to keep track of the node to which the relative path in the base node points.

Implements kanzi::AbstractNodeReference.

template<typename NodeType>
void kanzi::NodeReference< NodeType >::detach ( )
inlineoverridevirtual

Detaches a node reference.

When you detach a node reference, Kanzi stops tracking the node to which the relative path in the base node points.

Implements kanzi::AbstractNodeReference.

template<typename NodeType>
void kanzi::NodeReference< NodeType >::update ( )
inlineoverridevirtual

Refreshes a node reference.

Call this function when in the base node the value of the property that sets the relative path changes.

Implements kanzi::AbstractNodeReference.

template<typename NodeType>
void kanzi::NodeReference< NodeType >::setUserReference ( NodeTypeSharedPtr  node)
inline

Sets the node reference to refer to a node.

This function overrides the resolving referenced node by path. The node reference does not take ownership nor keeps alive the passed node.

Parameters
nodeA node to which the reference refers. To reset the reference and use the relative path set in the property of the base node, pass nullptr.
See also
get()
template<typename NodeType>
NodeTypeSharedPtr kanzi::NodeReference< NodeType >::get ( ) const
inline

Returns the referenced node.

Returns
Returns the referenced node referenced by relative path or with the setUserReference function.

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