|
RTC Toolkit 6.1.0-pre1
|
This represents a tree node in the repository tree model that also contains cached data. More...
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() | |
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.
| 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 ) |
| str gui.node.tree_node.TreeNode.__str__ | ( | self | ) |
|
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.
| new_shape | Target shape of the value. |
| gui.node.tree_node.TreeNode.add_child | ( | self, | |
| Node | child ) |
Adds a child node and marks this node as the parent.
| 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.
| 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.
| gui.node.tree_node.TreeNode.detach_symlinks | ( | self | ) |
Detaches all symlinks associated with this leaf node.
| 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.
| gui.node.tree_node.TreeNode.get_value | ( | self | ) |
Returns node's current value.
| 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.
| 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.
| bool gui.node.tree_node.TreeNode.is_requested | ( | self | ) |
Return whether any of the node's data is currently being requested.
| gui.node.tree_node.TreeNode.mark_ready | ( | self | ) |
| 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.
| 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.
| 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.
| new_metadata | New metadata dictionary to assign to the datapoint. |
| mark_cached | If True, marks the metadata and value state as CACHED; otherwise marks them as READY. |
| 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.
| 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.
|
protected |
|
protected |
| set[SymlinkNode] gui.node.tree_node.TreeNode.attached_symlinks = set() |
| list[Node] gui.node.tree_node.TreeNode.children = None if is_leaf else [] |
| gui.node.tree_node.TreeNode.children_state = NodeDataState.READY |
| gui.node.tree_node.TreeNode.metadata_state = NodeDataState.CACHED |
| gui.node.tree_node.TreeNode.value_state = NodeDataState.CACHED |