AuboStudio SDK 0.6.3

Public 成员函数 | Private 成员函数 | Private 属性 | 友元 | 所有成员列表
arcs::aubo_scope::TreeNode类 参考

`#include <tree_node.h>`

## Public 成员函数
| TreeNode (TreeNode &f)
| TreeNode (TreeNode &&f)
virtual | ~TreeNode ()
TreeNodePtr | addChild (ProgramNodePtr program_node)
| Add a child program node to the sub-tree. 更多...
TreeNodePtr | insertChildBefore (TreeNodePtr existingChildNode, ProgramNodePtr program_node)
| Inserts a child program node in the sub-tree directly before the existing selected child node. 更多...
TreeNodePtr | insertChildAfter (TreeNodePtr existingChildNode, ProgramNodePtr program_node)
| Inserts a child program node under in the sub-tree directly after the existing selected child node. 更多...
TreeNodePtr | cutChildNode (TreeNodePtr child)
| Cut a child program node under in the sub-tree directly after the existing selected child node. 更多...
bool | removeChild (TreeNodePtr program_node)
| Removes a child node from the sub-tree. 更多...
std::vector< TreeNodePtr > | getChildren ()
std::vector< TreeNodePtr > | getChildrenNotSuppressed ()
TreeNodePtr | getParent ()
ProgramNodePtr | getProgramNode ()
bool | isSuppressed ()
bool | isInProgramTree ()
| Whether the node is in the program tree; nodes not in the program tree may have been cut or deleted. 更多...
TreeNodePtr | locateDescendantTreeNode (ProgramNodePtr program_node)
void | setChildSequenceLocked (bool isChildSequenceLocked)
| Configures whether or not child nodes can be rearranged, deleted or have other nodes inserted into the child sequence by the end user. 更多...
int | traverse (std::function< int(ProgramNodePtr, int, int)> nodeVisitor)

## Private 成员函数
| TreeNode ()

## Private 属性
void * | d_ { nullptr }

## 友元
class | DataSwitch

## 详细描述

This interface represents a node in the program tree that can be used to construct a sub-tree rooted in a AuboCap program node.

Using the ProgramModel#getRootTreeNode(ProgramNodeContribution) to obtain a root for the sub-tree, it is possible to add children. For each call to TreeNode#addChild(ProgramNode), a new TreeNode is returned, that can, in turn, act as a root for yet another sub-tree.

在文件 tree_node.h 第 23 行定义.

## 构造及析构函数说明

## ◆ TreeNode() [1/3]

arcs::aubo_scope::TreeNode::TreeNode | ( | TreeNode & | f | ) |

## ◆ TreeNode() [2/3]

arcs::aubo_scope::TreeNode::TreeNode | ( | TreeNode && | f | ) |

## ◆ ~TreeNode()

virtual arcs::aubo_scope::TreeNode::~TreeNode | ( |  | ) |
| virtual

## ◆ TreeNode() [3/3]

arcs::aubo_scope::TreeNode::TreeNode | ( |  | ) |
| private

## 成员函数说明

## ◆ addChild()

TreeNodePtr arcs::aubo_scope::TreeNode::addChild | ( | ProgramNodePtr | program_node | ) |

Add a child program node to the sub-tree.

参数

  programNode | the ProgramNode constructed using the {} Returns a TreeNode that can be used to add children to the newly added child. TreeStructureException If it is not allowed to insert the { ProgramNode} at this position a TreeStructureException} will be thrown. IllegalStateException if called from a Swing-based AuboCap outside of an UndoableChanges} scope (see also { UndoRedoManager}).

## ◆ cutChildNode()

TreeNodePtr arcs::aubo_scope::TreeNode::cutChildNode | ( | TreeNodePtr | child | ) |

Cut a child program node under in the sub-tree directly after the existing selected child node.

Shifts any subsequent nodes to positions after the newly added child.

参数

  child | existing TreeNode child of this TreeNode.

返回
  Returns the TreeNode that has been cut off.

异常

  TreeStructureException | If it is not allowed to cut the {} or if the selected child node is not a child of this TreeNode a TreeStructureException} will be thrown. IllegalStateException if called from a Swing-based AuboCap outside of an UndoableChanges} scope (see also { UndoRedoManager}).

## ◆ getChildren()

std::vector<TreeNodePtr> arcs::aubo_scope::TreeNode::getChildren | ( |  | ) |

返回
  a list of `TreeNode` objects that represents all the children of this `TreeNode` (both programmatically added as well as inserted by the end user).

## ◆ getChildrenNotSuppressed()

std::vector<TreeNodePtr> arcs::aubo_scope::TreeNode::getChildrenNotSuppressed | ( |  | ) |

## ◆ getParent()

TreeNodePtr arcs::aubo_scope::TreeNode::getParent | ( |  | ) |

返回
  Parent treenode of the node

## ◆ getProgramNode()

ProgramNodePtr arcs::aubo_scope::TreeNode::getProgramNode | ( |  | ) |

返回
  Returns the ProgramNode at this position in the sub-tree. Can either be a built-in AuboScope program node (provided by AUBO Robots) or a AuboCap program node.

## ◆ insertChildAfter()

TreeNodePtr arcs::aubo_scope::TreeNode::insertChildAfter | ( | TreeNodePtr | existingChildNode,
|  | ProgramNodePtr | program_node
| ) |  |

Inserts a child program node under in the sub-tree directly after the existing selected child node.

Shifts any subsequent nodes to positions after the newly added child.

参数

  existingChildNode | existing TreeNode child of this TreeNode.
  programNode | the ProgramNode constructed using the {}. Returns a TreeNode that can be used to add children to the newly added child. TreeStructureException If it is not allowed to insert the { ProgramNode} at this position or if the selected child node is not a child of this TreeNode a TreeStructureException} will be thrown. IllegalStateException if called from a Swing-based AuboCap outside of an UndoableChanges} scope (see also { UndoRedoManager}).

## ◆ insertChildBefore()

TreeNodePtr arcs::aubo_scope::TreeNode::insertChildBefore | ( | TreeNodePtr | existingChildNode,
|  | ProgramNodePtr | program_node
| ) |  |

Inserts a child program node in the sub-tree directly before the existing selected child node.

Shifts the selected child node and any subsequent nodes to positions after the newly added child.

参数

  existingChildNode | existing TreeNode child of this TreeNode.
  programNode | the ProgramNode constructed using the {}. Returns a TreeNode that can be used to add children to the newly added child. TreeStructureException If it is not allowed to insert the { ProgramNode} at this position or if the selected child node is not a child of this TreeNode a TreeStructureException} will be thrown. IllegalStateException if called from a Swing-based AuboCap outside of an UndoableChanges} scope (see also { UndoRedoManager}).

## ◆ isInProgramTree()

bool arcs::aubo_scope::TreeNode::isInProgramTree | ( |  | ) |

Whether the node is in the program tree; nodes not in the program tree may have been cut or deleted.

返回
  Returns `true` The node is in the program tree. `false` The node is not in the program tree; such nodes may have been cut or deleted.

## ◆ isSuppressed()

bool arcs::aubo_scope::TreeNode::isSuppressed | ( |  | ) |

## ◆ locateDescendantTreeNode()

TreeNodePtr arcs::aubo_scope::TreeNode::locateDescendantTreeNode | ( | ProgramNodePtr | program_node | ) |

Gets a corresponding TreeNode instance for a child program node (a ProgramNode instance) in the sub-tree under this {}.

This method can for instance be used to gain access to the sub-tree under a child program node encountered when iterating the sub-tree of the parent node using the ProgramNodeVisitor (or any derived sub class thereof).

参数

  programNode | program node to get a corresponding TreeNode representation for, not `null`. Can either be a built-in AuboScope program node (provided by Universal Robots) or a AuboCap program node.

返回
  the `TreeNode` instance for the specified program node.

异常

  ProgramNodeNotInSubTreeException | when the program node cannot be found because it is not in the sub-tree.

## ◆ removeChild()

bool arcs::aubo_scope::TreeNode::removeChild | ( | TreeNodePtr | program_node | ) |

Removes a child node from the sub-tree.

Be aware that removing the last child will trigger the insertion of an {@literal <empty>} child node.

参数

  child | The TreeNode child to be removed.

返回
  Returns `true` if removed successfully. `false` otherwise.

异常

  TreeStructureException | If the removed child would leave the tree in an illegal state a TreeStructureException will be thrown.
  IllegalStateException | if called from a Swing-based AuboCap outside of an UndoableChanges scope (see also {}).

## ◆ setChildSequenceLocked()

void arcs::aubo_scope::TreeNode::setChildSequenceLocked | ( | bool | isChildSequenceLocked | ) |

Configures whether or not child nodes can be rearranged, deleted or have other nodes inserted into the child sequence by the end user.

参数

  isChildSequenceLocked | If `true` then the immediate children under this `TreeNode` will be locked.

## ◆ traverse()

int arcs::aubo_scope::TreeNode::traverse | ( | std::function< int(ProgramNodePtr, int, int)> | nodeVisitor | ) |

This method traverses the entire sub-tree under this tree node in a depth-first fashion (this corresponds to a top-down approach in the program tree).

A node visitor is used for callbacks to the visit-overloads you choose to override. The overload called depends on the node type encountered. Override the overloads for the node types you are concerned with. All visit-methods have the program node, sibling index and depth as arguments to help filter nodes if needed.

The node visitor can be either a ProgramNodeVisitor implementation with optional overrides or a ProgramNodeInterfaceVisitor implementation. In the latter case, the ProgramNodeInterfaceVisitor#visitAs(Object, int, int) method must be implemented.

The ProgramNodeInterfaceVisitor can be used when targeting AuboCap program nodes implementing the (generic) type parameter specified in ProgramNodeInterfaceVisitor (see also ProgramNode#getAs(Class)).

Note that this method is sometimes called `accept()` in the Visitor software design pattern.

参数

  nodeVisitor | the instance callbacks are made to.

返回
  0 for normal exit. non-zero for exception or error causing premature exit.

## 友元及相关函数文档

## ◆ DataSwitch

friend class DataSwitch
| friend

在文件 tree_node.h 第 227 行定义.

## 类成员变量说明

## ◆ d_

void* arcs::aubo_scope::TreeNode::d_ { nullptr }
| private

在文件 tree_node.h 第 229 行定义.

该类的文档由以下文件生成:

- include/aubo_caps/domain/program/structure/tree_node.h