Table of Contents

Table of Contents

CouplingDataType

CouplingDataType

Description

Inherits SimpleDataType

Coupling data allows nodes in the tree to point to other nodes safely. The connection between the nodes can be one-way or two-way. The connection will be accurately saved and loaded. When the node referenced by coupling data is destroyed, the remaining node's data is set to 0. If the link is two-way, then both nodes are destroyed when one is destroyed.

Extending this class allows you to store addtional data with the link. For example, if the link represents an edge in a graph, then the extended class could store the length or weight of the edge, the type of edge, etc.

Related Functions

FunctionDescription
treenode createcoupling(treenode container1, treenode container2) Adds a subnode to both containers and creates a two-way link between subnodes. Returns the value of container1.
double nodejoin(treenode node1, treenode node2) Creates a two-way link between the two input nodes. Returns 0 on failure, 1 on success.
treenode nodepoint(treenode from, treenode to) Creates a one-way link between the two input nodes.
treenode nodeaddcouplingdata(treenode target, CouplingDataType* cdt, int bind) Adds the specified coupling data to the target node, and specifies whether to bind on create. Returns the target node.

Implementation

Virtual Methods

MethodDescription
void bind(void)Inherited from SimpleDataType.
char* toString(int verbose)Inherited from SimpleDataType.