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