The following code fragment shows a typical use of the e4_MarkerVisitor class:
The marker visitor mv is initialized to visit all markers in the storage that contains the marker m. We iterate over each marker in turn, and when we reach the marker m that was used to initialize the visitor mv, we print a message to stderr.e4_Storage s("mystorage", E4_METAKIT); e4_Marker m; ... if (!s.GetMarker("mymarker", m)) {...} ... e4_MarkerVisitor mv(m); e4_Marker cm; while (mv.CurrentMarkerAndAdvance(cm)) { if (!cm.IsValid()) {...} if (cm == m) { fprintf(stderr, "Found our marker, %s %s\n", cm.GetName(), m.GetName()); } }
The following methods are provided by the e4_MarkerVisitor class:
e4_MarkerVisitor() | Default constructor. Creates an instance of e4_MarkerVisitor that is initially invalid, because it is not connected to a storage and has no currently visited marker. |
e4_MarkerVisitor(const e4_MarkerVisitor &referrer) | Copy constructor. Creates an instance of e4_MarkerVisitor that will visit markers in the same storage as referrer and in the same order. |
e4_MarkerVisitor(const e4_Storage &s) | Constructor that creates an instance of e4_MarkerVisitor that will visit all markers defined in the storage s. |
e4_MarkerVisitor(const e4_Marker &m) | Constructor that creates an instance of e4_MarkerVisitor that will visit all markers in the storage containing the marker m. |
e4_MarkerVisitor(const e4_Node &n) | Constructor that creates an instance of e4_MarkerVisitor that will visit all markers in the storage containing the node n. |
e4_MarkerVisitor(const e4_Vertex &v) | Constructor that creates an instance of e4_MarkerVisitor that will visit all markers in the storage containing the vertex v. |
~e4_MarkerVisitor() | Destructor. |
e4_MarkerVisitor &operator=(const e4_MarkerVisitor &referrer) | Assignment operator. The current instance will visit markers in the same storage as referrer and in the same order. |
bool operator==(const e4_MarkerVisitor &comp) | Returns true if this instance and comp refer to the same instance of e4_MarkerVisitor. |
bool operator!=(const e4_MarkerVisitor &comp) | Returns true if this instance and comp do not refer to the same instance of e4_MarkerVisitor. |
bool IsDone() | Returns true if there are no more markers to visit. |
bool IsValid() | Returns true if this instance of e4_MarkerVisitor is valid. An instance is valid if it has a current marker being visited. |
bool CurrentMarker(e4_Marker &m) | Returns true if the current marker being visited is successfully retrieved in m. |
bool NextMarker(e4_Marker &m) | Returns true if the visitor is successfully advanced to the next marker to be visited and that marker is successfully retrieved in m. |
bool CurrentMarkerAndAdvance(e4_Marker &m) | Returns true if the current marker being visited is successfully retrieved in m and the visitor is successfully advanced to the next marker to be visited. |
bool SetStorage(e4_Storage &s) | Returns true if the visitor is successfully reset to visit all markers defined in the storage s. |
bool SetMarker(e4_Marker &m) | Returns true if the visitor is successfully reset to visit all markers defined in the storage containing the marker m. |
bool SetNode(e4_Node &n) | Returns true if the visitor is successfully reset to visit all markers defined in the storage containing the node n. |
bool SetVertex(e4_Vertex &v) | Returns true if the visitor is successfully reset to visit all markers defined in the storage containing the vertex v. |