The following code fragment shows a typical use of the e4_NodeVisitor class:
The e4_NodeVisitor class provides the following methods:e4_Storage s("mystorage", E4_METAKIT); e4_Node n; ... if (!s.GetRootNode(n)) {...} ... e4_Node cn; e4_NodeVisitor nv(n); while (nv.CurrentNodeAndAdvance(cn)) { if (!cn.IsValid()) {...} if (cn == n) { cerr << "Found our node, " << cn.GetUniqueID() << ", " << n.GetUniqueID() << ".\n"; } }
e4_NodeVisitor() | Default constructor. Creates an instance of e4_NodeVisitor that is initially invalid, because it is not connected to a storage and has no currently visited node.fs |
e4_NodeVisitor(const e4_NodeVisitor &referrer) | Copy constructor. Creates an instance of e4_NodeVisitor that will visit nodes in the same storage as referrer and in the same order. |
e4_NodeVisitor(const e4_Storage &s) | Constructor that creates an instance of e4_NodeVisitor that will visit all the attached nodes defined in the storage s. Note that this visitor will visit the root node even if the root node is detached. |
e4_NodeVisitor(const e4_Storage &s, e4_DetachChoice dc) | Constructor that creates an instance of e4_NodeVisitor that will visit all the nodes selected according to dc that are defined in the storage s. |
e4_NodeVisitor(const e4_Node &n) | Constructor that creates an instance of e4_NodeVisitor that will visit all the nodes defined in the storage containing the node n. If the node n is detached, the visitor will visit only detached nodes. If the node n is attached or is the root node, the visitor will visit the root node and all attached nodes in this storage. |
e4_NodeVisitor(const e4_Vertex &v) | Constructor that creates an instance of e4_NodeVisitor that will visit all the attached nodes and the root node defined in the storage containing the vertex v. |
~e4_NodeVisitor() | Destructor. |
e4_NodeVisitor &operator=(const e4_NodeVisitor &referrer) | Assignment operator. Makes this instance visit the same nodes as referrer and in the same order. |
bool operator==(const e4_NodeVisitor &comp) | Returns true if this and comp are equal e4_NodeVisitor instances. Instances are considered equal if they visit the same set of nodes and are at the same position in their itinerary. All invalid instances are equal. |
bool operator!=(const e4_NodeVisitor &comp) | Returns true if this and comp are not equal. All invalid instances are equal. |
bool IsDone() | Returns true if this instance of e4_NodeVisitor has no more nodes to visit or if the current node being visited is invalid. |
bool IsValid() | Returns true if this instance of e4_NodeVisitor is valid. An instance is valid if it has a current valid node being visited. |
bool CurrentNode(e4_Node &n) | Returns true if the node currently being visited is valid and is successfully retrieved in n. |
bool NextNode(e4_Node &n) | Returns true if the visitor is successfully advanced to the next node to be visited and that node is valid and is successfully retrieved in n. |
bool Advance() | Returns true if the visitor is successfully advanced to the next node to be visited and that node is valid. |
bool CurrentNodeAndAdvance(e4_Node &n) | Returns true if the node currently being visited is valid and is successfully retrieved in n. An attempt is made to advance the visitor to the next node to be visited; if this is unsuccessful then subsequent calls to IsDone() will return true. |
bool SetStorage(const e4_Storage &s) | Returns true if the visitor is successfully reset to visit all attached nodes defined in the storage s. |
bool SetStorage(const e4_Storage &s, e4_DetachChoice dc) | Returns true if the visitor is successfully reset to visit all nodes selected according to dc that are defined in the storage s. |
bool SetNode(const e4_Node &n) | Returns true if the visitor is successfully reset to visit all nodes of the same kind defined in the storage containing the node n. If n is detached, the visitor will visit only detached nodes. If n is attached or the root node, the visitor will visit all attached nodes and the root node of the storage containing n. |
bool SetVertex(const e4_Vertex &v) | Returns true if the visitor is successfully reset to visit all attached nodes and the root node defined in the storage containing the vertex v. |