navigate.model.features.feature_container.Container
- class navigate.model.features.feature_container.Container(root=None, cleanup_list=[])
Bases:
object
Container class for managing a control sequence tree.
This class is responsible for managing a control sequence tree, which consists of nodes representing different actions or steps in the control sequence. It provides methods for resetting the tree and performing cleanup operations on specified nodes.
Notes:
The Container class is used to manage the execution of a control sequence tree. It maintains the state of the control sequence and provides methods for resetting the state and performing cleanup operations.
The root attribute represents the root node of the control sequence tree, which serves as the entry point for executing the control sequence.
The curr_node attribute tracks the currently running node in the control sequence.
The end_flag attribute is used to signal the termination of control sequence execution.
The cleanup_list attribute is a list of nodes that contain ‘cleanup’ functions. These functions are executed when the container is closed, allowing for resource cleanup.
The is_closed attribute indicates whether the container has been closed or not.
- __init__(root=None, cleanup_list=[])
Initialize the Container object.
Parameters:
- rootTreeNode or None, optional
The root node of the control sequence tree. Default is None.
- cleanup_listlist of TreeNode, optional
A list of nodes containing ‘cleanup’ functions to be executed when the container is closed. Default is an empty list.
Methods
__init__
([root, cleanup_list])Initialize the Container object.
cleanup
()Execute 'cleanup' functions for specified nodes in the tree.
reset
()Reset the container's state, including the current node and end flag.
Attributes
The root node of the control sequence tree.
The currently running node in the control sequence.
A flag indicating whether the control sequence execution should stop.
A boolean indicating whether the container is closed.
- cleanup()
Execute ‘cleanup’ functions for specified nodes in the tree.
This method executes the ‘cleanup’ functions associated with nodes in the cleanup_list. These functions are typically used to perform resource cleanup or finalization when the container is closed. The ‘cleanup_list’ specifies which nodes should have their ‘cleanup’ functions executed.
- reset()
Reset the container’s state, including the current node and end flag.
This method resets the state of the container, including setting the current node to None and clearing the end flag. It prepares the container for running the control sequence from the beginning.
- end_flag
A flag indicating whether the control sequence execution should stop.
- Type:
bool
- is_closed
A boolean indicating whether the container is closed.
- Type:
bool