Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

C++ Boost

EventVisitor Concept

This concept defines the interface for single-event visitors. An EventVisitor has an apply member function (operator()) which is invoked within the graph algorithm at the event-point specified by the event_filter typedef within the EventVisitor. EventVisitor's can be combined into an EventVistorList.

The following is the list of event tags that can be invoked in BGL algorithms. Each tag corresponds to a member function of the visitor for an algorithm. For example, the BFSVisitor of breadth_first_search() has a cycle_edge() member function. The corresponding tag is on_cycle_edge. The first argument is the event visitor's operator() must be either an edge or vertex descriptor depending on the event tag.

namespace boost {
  struct on_initialize_vertex { };
  struct on_start_vertex { };
  struct on_discover_vertex { };
  struct on_examine_edge { };
  struct on_tree_edge { };
  struct on_cycle_edge { };
  struct on_finish_vertex { };
  struct on_forward_or_cross_edge { };
  struct on_back_edge { };
  struct on_edge_relaxed { };
  struct on_edge_not_relaxed { };
  struct on_edge_minimized { };
  struct on_edge_not_minimized { };
} // namespace boost

Refinement of

Copy Constructible (copying a visitor should be a lightweight operation).

Notation

G A type that is a model of Graph.
g An object of type G.
V A type that is a model of EventVisitor.
vis An object of type V.
x An object of type boost::graph_traits<G>::vertex_descriptor or boost::graph_traits<G>::edge_descriptor.

Associated Types

Event Filter V::event_filter A tag struct to specify on which event the visitor should be invoked.

Valid Expressions

NameExpressionReturn TypeDescription
Apply Visitor vis(x, g) void Invokes the visitor operation on object x, which is either a vertex or edge descriptor of the graph.

Models

See Also

EventVisitorList, Visitor concepts

Copyright © 2000-2001 Jeremy Siek, Indiana University (jsiek@osl.iu.edu)
Lie-Quan Lee, Indiana University (llee@cs.indiana.edu)
Andrew Lumsdaine, Indiana University (lums@osl.iu.edu)