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>
Public Types | |
typedef shared_ptr< NodeType > | NodeTypeSharedPtr |
typedef weak_ptr< NodeType > | NodeTypeWeakPtr |
Public Member Functions | |
void | attach () override |
Attaches a node reference. | |
void | detach () override |
Detaches a node reference. | |
NodeTypeSharedPtr | get () const |
Returns the referenced node. | |
NodeReference (Node &baseNode, const PropertyType< string > &propertyType) | |
Constructor. | |
void | setUserReference (NodeTypeSharedPtr node) |
Sets the node reference to refer to a node. | |
void | update () override |
Refreshes a node reference. | |
virtual | ~NodeReference () |
Destructor. | |
Additional Inherited Members | |
Protected Member Functions inherited from kanzi::AbstractNodeReference | |
~AbstractNodeReference () | |
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.
typedef shared_ptr<NodeType> kanzi::NodeReference< NodeType >::NodeTypeSharedPtr |
typedef weak_ptr<NodeType> kanzi::NodeReference< NodeType >::NodeTypeWeakPtr |
|
inlineexplicit |
Constructor.
baseNode | The node where Kanzi installs the constructed node reference. |
propertyType | The property of a baseNode the value of which Kanzi is using to resolve the referenced node. |
|
inlinevirtual |
Destructor.
|
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.
|
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.
|
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.
|
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.
node | A 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. |
|
inline |
Returns the referenced node.