E57 Foundation API v1.1.312  Aug. 10, 2011
Node parent ( ) const

Return parent of node, or self if a root node.

Nodes are organized into trees (acyclic graphs) with a distinguished node (the "top-most" node) called the root node. A parent-child relationship is established between nodes to form a tree. Nodes can have zero or one parent. Nodes with zero parents are called root nodes. In the API, if a node has zero parents it is represented by having itself as a parent. Due to the set-once design of the API, a parent-child relationship cannot be modified once established. A child node can be any of the 8 node types, but a parent node can only be one of the 3 container node types (E57_STRUCTURE, E57_VECTOR, and E57_COMPRESSED_VECTOR). Each parent-child link has a string name (the elementName) associated with it (See Node::elementName for more details). More than one tree can be formed at any given time. Typically small trees are temporarily constructed before attachement to an ImageFile so that they will be written to the disk.

Warning: user algorithms that use this function to walk the tree must take care to handle the case where a node is its own parent (it is a root node). Use Node::isRoot to avoid infinite loops or infinite recursion.

Precondition:
The destination ImageFile must be open (i.e. destImageFile().isOpen()).
Postcondition:
No visible state is modified.
Returns:
A smart Node handle referencing the parent node or this node if is a root node.
Exceptions:
E57_ERROR_IMAGEFILE_NOT_OPEN
E57_ERROR_INTERNALAll objects in undocumented state
See also:
NodeFunctions.cpp example, Node::isRoot, Node::isAttached, CompressedVectorNode::CompressedVectorNode, Node::elementName
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines