| 1 | <HTML> | 
|---|
| 2 | <!-- | 
|---|
| 3 |   -- Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000 | 
|---|
| 4 |   -- | 
|---|
| 5 |   -- Permission to use, copy, modify, distribute and sell this software | 
|---|
| 6 |   -- and its documentation for any purpose is hereby granted without fee, | 
|---|
| 7 |   -- provided that the above copyright notice appears in all copies and | 
|---|
| 8 |   -- that both that copyright notice and this permission notice appear | 
|---|
| 9 |   -- in supporting documentation.  We make no | 
|---|
| 10 |   -- representations about the suitability of this software for any | 
|---|
| 11 |   -- purpose.  It is provided "as is" without express or implied warranty. | 
|---|
| 12 |   --> | 
|---|
| 13 | <Head> | 
|---|
| 14 | <Title>Boost Graph Library: EventVisitor</Title> | 
|---|
| 15 | <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"  | 
|---|
| 16 |         ALINK="#ff0000">  | 
|---|
| 17 | <IMG SRC="../../../boost.png"  | 
|---|
| 18 |      ALT="C++ Boost" width="277" height="86">  | 
|---|
| 19 |  | 
|---|
| 20 | <BR Clear> | 
|---|
| 21 |  | 
|---|
| 22 | <H1>EventVisitor Concept</H1> | 
|---|
| 23 |  | 
|---|
| 24 | This concept defines the interface for single-event visitors. An | 
|---|
| 25 | EventVisitor has an apply member function (<tt>operator()</tt>) which | 
|---|
| 26 | is invoked within the graph algorithm at the event-point specified by | 
|---|
| 27 | the <tt>event_filter</tt> typedef within the | 
|---|
| 28 | EventVisitor. EventVisitor's can be combined into an <a | 
|---|
| 29 | href="./EventVisitorList.html">EventVistorList</a>. | 
|---|
| 30 |  | 
|---|
| 31 | <p> | 
|---|
| 32 | The following is the list of event tags that can be invoked in BGL | 
|---|
| 33 | algorithms. Each tag corresponds to a member function of the visitor | 
|---|
| 34 | for an algorithm. For example, the <a | 
|---|
| 35 | href="./BFSVisitor.html">BFSVisitor</a> of <a | 
|---|
| 36 | href="./breadth_first_search.html"><tt>breadth_first_search()</tt></a> | 
|---|
| 37 | has a <tt>cycle_edge()</tt> member function. The corresponding tag is | 
|---|
| 38 | <tt>on_cycle_edge</tt>. The first argument is the event visitor's | 
|---|
| 39 | <tt>operator()</tt> must be either an edge or vertex descriptor | 
|---|
| 40 | depending on the event tag. | 
|---|
| 41 |  | 
|---|
| 42 | <pre> | 
|---|
| 43 | namespace boost { | 
|---|
| 44 |   struct on_initialize_vertex { }; | 
|---|
| 45 |   struct on_start_vertex { }; | 
|---|
| 46 |   struct on_discover_vertex { }; | 
|---|
| 47 |   struct on_examine_edge { }; | 
|---|
| 48 |   struct on_tree_edge { }; | 
|---|
| 49 |   struct on_cycle_edge { }; | 
|---|
| 50 |   struct on_finish_vertex { }; | 
|---|
| 51 |   struct on_forward_or_cross_edge { }; | 
|---|
| 52 |   struct on_back_edge { }; | 
|---|
| 53 |   struct on_edge_relaxed { }; | 
|---|
| 54 |   struct on_edge_not_relaxed { }; | 
|---|
| 55 |   struct on_edge_minimized { }; | 
|---|
| 56 |   struct on_edge_not_minimized { }; | 
|---|
| 57 | } // namespace boost | 
|---|
| 58 | </pre> | 
|---|
| 59 |  | 
|---|
| 60 |  | 
|---|
| 61 | <h3>Refinement of</h3> | 
|---|
| 62 |  | 
|---|
| 63 | <a href="../../utility/CopyConstructible.html">Copy Constructible</a> | 
|---|
| 64 | (copying a visitor should be a lightweight operation). | 
|---|
| 65 |  | 
|---|
| 66 | <h3>Notation</h3> | 
|---|
| 67 |  | 
|---|
| 68 | <Table> | 
|---|
| 69 | <TR> | 
|---|
| 70 | <TD><tt>G</tt></TD> | 
|---|
| 71 | <TD>A type that is a model of <a href="./Graph.html">Graph</a>.</TD> | 
|---|
| 72 | </TR> | 
|---|
| 73 |  | 
|---|
| 74 | <TR> | 
|---|
| 75 | <TD><tt>g</tt></TD> | 
|---|
| 76 | <TD>An object of type <tt>G</tt>.</TD> | 
|---|
| 77 | </TR> | 
|---|
| 78 |  | 
|---|
| 79 | <TR> | 
|---|
| 80 | <TD><tt>V</tt></TD> | 
|---|
| 81 | <TD>A type that is a model of EventVisitor.</TD> | 
|---|
| 82 | </TR> | 
|---|
| 83 |  | 
|---|
| 84 | <TR> | 
|---|
| 85 | <TD><tt>vis</tt></TD> | 
|---|
| 86 | <TD>An object of type <tt>V</tt>.</TD> | 
|---|
| 87 | </TR> | 
|---|
| 88 |  | 
|---|
| 89 | <TR> | 
|---|
| 90 | <TD><tt>x</tt></TD> | 
|---|
| 91 | <TD>An object of type | 
|---|
| 92 | <tt>boost::graph_traits<G>::vertex_descriptor</tt> | 
|---|
| 93 | or <tt>boost::graph_traits<G>::edge_descriptor</tt>.</TD> | 
|---|
| 94 | </TR> | 
|---|
| 95 |  | 
|---|
| 96 | </table> | 
|---|
| 97 |  | 
|---|
| 98 | <h3>Associated Types</h3> | 
|---|
| 99 |  | 
|---|
| 100 | <Table border> | 
|---|
| 101 |  | 
|---|
| 102 | <TR> | 
|---|
| 103 | <TD>Event Filter </TD> | 
|---|
| 104 | <TD><TT>V::event_filter</TT></TD> | 
|---|
| 105 | <TD> | 
|---|
| 106 | A tag struct to specify on which event the visitor should be invoked. | 
|---|
| 107 | </TD> | 
|---|
| 108 | </TR> | 
|---|
| 109 |  | 
|---|
| 110 | </table> | 
|---|
| 111 |  | 
|---|
| 112 | <h3>Valid Expressions</h3> | 
|---|
| 113 |  | 
|---|
| 114 | <Table border> | 
|---|
| 115 |  | 
|---|
| 116 | <tr> | 
|---|
| 117 | <th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th> | 
|---|
| 118 | </tr> | 
|---|
| 119 |  | 
|---|
| 120 | <tr> | 
|---|
| 121 | <td>Apply Visitor</td> | 
|---|
| 122 | <td><TT>vis(x, g)</TT></TD> | 
|---|
| 123 | <TD><TT>void</TT></TD> | 
|---|
| 124 | <TD> | 
|---|
| 125 | Invokes the visitor operation on object <tt>x</tt>, which is | 
|---|
| 126 | either a vertex or edge descriptor of the graph. | 
|---|
| 127 | </TD> | 
|---|
| 128 | </TR> | 
|---|
| 129 |  | 
|---|
| 130 |  | 
|---|
| 131 | </table> | 
|---|
| 132 |  | 
|---|
| 133 |  | 
|---|
| 134 | <h3>Models</h3> | 
|---|
| 135 |  | 
|---|
| 136 | <ul> | 
|---|
| 137 |  <li><a | 
|---|
| 138 |  href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a> | 
|---|
| 139 |  <li><a href="./distance_recorder.html"><tt>distance_recorder</tt></a> | 
|---|
| 140 |  <li><a href="./time_stamper.html"><tt>time_stamper</tt></a> | 
|---|
| 141 |  <li><a href="./property_writer.html"><tt>property_writer</tt></a> | 
|---|
| 142 |  <li><a href="./null_visitor.html"><tt>null_visitor</tt></a> | 
|---|
| 143 | </ul> | 
|---|
| 144 |  | 
|---|
| 145 | <h3>See Also</h3> | 
|---|
| 146 |  | 
|---|
| 147 | <a href="./EventVisitorList.html">EventVisitorList</a>, | 
|---|
| 148 | <a href="./visitor_concepts.html">Visitor concepts</a> | 
|---|
| 149 |  | 
|---|
| 150 | <br> | 
|---|
| 151 | <HR> | 
|---|
| 152 | <TABLE> | 
|---|
| 153 | <TR valign=top> | 
|---|
| 154 | <TD nowrap>Copyright © 2000-2001</TD><TD> | 
|---|
| 155 | <A HREF="../../../people/jeremy_siek.htm">Jeremy Siek</A>, | 
|---|
| 156 | Indiana University (<A | 
|---|
| 157 | HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br> | 
|---|
| 158 | <A HREF="../../../people/liequan_lee.htm">Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@cs.indiana.edu">llee@cs.indiana.edu</A>)<br> | 
|---|
| 159 | <A HREF=http://www.osl.iu.edu/~lums>Andrew Lumsdaine</A>, | 
|---|
| 160 | Indiana University (<A | 
|---|
| 161 | HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>) | 
|---|
| 162 | </TD></TR></TABLE> | 
|---|
| 163 |  | 
|---|
| 164 | </BODY> | 
|---|
| 165 | </HTML>  | 
|---|