RTC Toolkit 6.1.0-pre1
Loading...
Searching...
No Matches
gui.node.tree_node.TreeNode Class Reference

This represents a tree node in the repository tree model that also contains cached data. More...

Inheritance diagram for gui.node.tree_node.TreeNode:

Public Member Functions

 __init__ (self, DataPointPath path, bool is_leaf=False, bool mark_cached=False, bool mark_ready=False, bool mark_requested=False)
 
bool is_leaf (self)
 Returns True if this is a leaf node of the tree, i.e.
 
bool can_fetch_more (self)
 Returns True if any of the data items are stale and not yet requested, otherwise False is returned.
 
bool is_requested (self)
 Return whether any of the node's data is currently being requested.
 
 mark_ready (self)
 
 get_value (self)
 Returns node's current value.
 
 set_value (self, Any new_value, bool mark_cached=False)
 Sets the datapoint value of the tree node and marks the value as ready, i.e.
 
dict get_metadata (self, bool except_internals=False)
 Getter that returns a copy of the datapoint metadata.
 
 set_metadata (self, dict new_metadata, bool mark_cached=False)
 Updates the datapoint metadata and synchronizes the associated value.
 
 update_metadata (self, str key, value, mark_cached=False)
 Updates one metadata entry identified by key.
 
 add_child (self, Node child)
 Adds a child node and marks this node as the parent.
 
 insert_child (self, int position, Node child)
 Inserts a child tree node into a particular position and marks this node as the parent.
 
 remove_child (self, Node child)
 Removes a child tree node from this node and resets the child's parent pointer.
 
Sequence[Node] remove_children (self, int position, int count)
 Removes multiple child tree nodes from this node and resets the removed children's parent pointers.
 
SymlinkNode convert_to_symlink (self, DataPointPath links_to, bool mark_cached=False)
 Convert this leaf node into a SymlinkNode while preserving its position in the parent's children.
 
 detach_symlinks (self)
 Detaches all symlinks associated with this leaf node.
 
str __str__ (self)
 

Public Attributes

list[Node] children = None if is_leaf else []
 
set[SymlinkNode] attached_symlinks = set()
 
 children_state = NodeDataState.READY
 
 value_state = NodeDataState.CACHED
 
 metadata_state = NodeDataState.CACHED
 

Protected Member Functions

 _reshape_value (self, RtcVectorUInt64 new_shape)
 Reshapes the datapoint's value to the specified shape.
 

Protected Attributes

 _value = None
 
 _metadata = dict()
 

Detailed Description

This represents a tree node in the repository tree model that also contains cached data.

Leaf nodes represent datapoints in the repository, while non-leaf nodes represent folders in the datapoint hierarchy.

Constructor & Destructor Documentation

◆ __init__()

gui.node.tree_node.TreeNode.__init__ ( self,
DataPointPath path,
bool is_leaf = False,
bool mark_cached = False,
bool mark_ready = False,
bool mark_requested = False )

Member Function Documentation

◆ __str__()

str gui.node.tree_node.TreeNode.__str__ ( self)

◆ _reshape_value()

gui.node.tree_node.TreeNode._reshape_value ( self,
RtcVectorUInt64 new_shape )
protected

Reshapes the datapoint's value to the specified shape.

Adjusts the stored value while preserving existing data where possible. Supports resizing NumPy-based arrays as well as RtcString and RtcBinary values. Newly allocated elements are initialized with default values.

Parameters
new_shapeTarget shape of the value.

◆ add_child()

gui.node.tree_node.TreeNode.add_child ( self,
Node child )

Adds a child node and marks this node as the parent.

◆ can_fetch_more()

bool gui.node.tree_node.TreeNode.can_fetch_more ( self)

Returns True if any of the data items are stale and not yet requested, otherwise False is returned.

◆ convert_to_symlink()

SymlinkNode gui.node.tree_node.TreeNode.convert_to_symlink ( self,
DataPointPath links_to,
bool mark_cached = False )

Convert this leaf node into a SymlinkNode while preserving its position in the parent's children.

Optionally mark the new symlink as cached.

◆ detach_symlinks()

gui.node.tree_node.TreeNode.detach_symlinks ( self)

Detaches all symlinks associated with this leaf node.

◆ get_metadata()

dict gui.node.tree_node.TreeNode.get_metadata ( self,
bool except_internals = False )

Getter that returns a copy of the datapoint metadata.

The metadata field should not be modified directly. These changes should be performed through set_metadata method. Changes made to this copy shouldn't affect the real metadata.

◆ get_value()

gui.node.tree_node.TreeNode.get_value ( self)

Returns node's current value.

◆ insert_child()

gui.node.tree_node.TreeNode.insert_child ( self,
int position,
Node child )

Inserts a child tree node into a particular position and marks this node as the parent.

◆ is_leaf()

bool gui.node.tree_node.TreeNode.is_leaf ( self)

Returns True if this is a leaf node of the tree, i.e.

corresponds to an actual datapoint value, and False otherwise.

◆ is_requested()

bool gui.node.tree_node.TreeNode.is_requested ( self)

Return whether any of the node's data is currently being requested.

◆ mark_ready()

gui.node.tree_node.TreeNode.mark_ready ( self)

◆ remove_child()

gui.node.tree_node.TreeNode.remove_child ( self,
Node child )

Removes a child tree node from this node and resets the child's parent pointer.

◆ remove_children()

Sequence[Node] gui.node.tree_node.TreeNode.remove_children ( self,
int position,
int count )

Removes multiple child tree nodes from this node and resets the removed children's parent pointers.

The removed nodes are returned.

◆ set_metadata()

gui.node.tree_node.TreeNode.set_metadata ( self,
dict new_metadata,
bool mark_cached = False )

Updates the datapoint metadata and synchronizes the associated value.

Replaces the current metadata with the provided metadata and updates the metadata state. If the metadata type entry changes, the value is updated using the new type's default value and the shape is adjusted accordingly. If the metadata shape changes, the existing value is resized.

Parameters
new_metadataNew metadata dictionary to assign to the datapoint.
mark_cachedIf True, marks the metadata and value state as CACHED; otherwise marks them as READY.

◆ set_value()

gui.node.tree_node.TreeNode.set_value ( self,
Any new_value,
bool mark_cached = False )

Sets the datapoint value of the tree node and marks the value as ready, i.e.

not stale.

◆ update_metadata()

gui.node.tree_node.TreeNode.update_metadata ( self,
str key,
value,
mark_cached = False )

Updates one metadata entry identified by key.

If entry witch such key does not exist, it is created.

Member Data Documentation

◆ _metadata

gui.node.tree_node.TreeNode._metadata = dict()
protected

◆ _value

gui.node.tree_node.TreeNode._value = None
protected

◆ attached_symlinks

set[SymlinkNode] gui.node.tree_node.TreeNode.attached_symlinks = set()

◆ children

list[Node] gui.node.tree_node.TreeNode.children = None if is_leaf else []

◆ children_state

gui.node.tree_node.TreeNode.children_state = NodeDataState.READY

◆ metadata_state

gui.node.tree_node.TreeNode.metadata_state = NodeDataState.CACHED

◆ value_state

gui.node.tree_node.TreeNode.value_state = NodeDataState.CACHED

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