]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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: time_stamper</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> | |
19 | <pre> | |
20 | time_stamper<TimeMap, TimeT, EventTag> | |
21 | </pre> | |
22 | </H1> | |
23 | ||
24 | This is an <a href="./EventVisitor.html">EventVisitor</a> that can be | |
25 | used to "stamp" a time at some event-point within an | |
26 | algorithm. An example of this is recording the discover or finish time | |
27 | of a vertex during a graph search. | |
28 | ||
29 | <p> | |
30 | <tt>time_stamper</tt> can be used with graph algorithms by | |
31 | wrapping it with the algorithm specific adaptor, such as <a | |
32 | href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a | |
33 | href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event | |
34 | visitor can be combined with other event visitors using | |
35 | <tt>std::pair</tt> to form an EventVisitorList. | |
36 | ||
37 | <h3>Example</h3> | |
38 | ||
39 | The following example shows the usage of the <tt>time_stamper</tt>. | |
40 | ||
41 | ||
42 | <pre> | |
43 | std::vector<default_color_type> color(num_vertices(G)); | |
44 | std::vector<size_type> dtime(num_vertices(G)); | |
45 | std::vector<size_type> ftime(num_vertices(G)); | |
46 | ||
47 | int time = 0; | |
48 | boost::breadth_first_search | |
49 | (G, vertex(s, G), make_bfs_visitor( | |
50 | std::make_pair(stamp_times(dtime.begin(), time, on_discover_vertex()), | |
51 | stamp_times(ftime.begin(), time, on_finish_vertex()))), | |
52 | color.begin()); | |
53 | </pre> | |
54 | ||
55 | <h3>Model of</h3> | |
56 | ||
57 | <a href="./EventVisitor.html">EventVisitor</a> | |
58 | ||
59 | ||
60 | <H3>Where Defined</H3> | |
61 | ||
62 | <P> | |
63 | <a href="../../../boost/graph/visitors.hpp"> | |
64 | <TT>boost/graph/visitors.hpp</TT></a> | |
65 | ||
66 | <H3>Template Parameters</H3> | |
67 | ||
68 | <P> | |
69 | <TABLE border> | |
70 | <TR> | |
71 | <th>Parameter</th><th>Description</th><th>Default</th> | |
72 | </tr> | |
73 | ||
74 | <TR><TD><TT>TimeMap</TT></TD> | |
75 | <TD> | |
76 | A <a | |
77 | href="../../property_map/doc/WritablePropertyMap.html">WritablePropertyMap</a> | |
78 | where the <tt>key_type</tt> is the vertex descriptor type or edge | |
79 | descriptor of the graph (depending on the kind of event tag) and | |
80 | where the <tt>TimeT</tt> type is convertible to the | |
81 | <tt>value_type</tt> of the time property map. | |
82 | </TD> | |
83 | <TD> </TD> | |
84 | </TR> | |
85 | ||
86 | <TR><TD><TT>TimeT</TT></TD> | |
87 | <TD> | |
88 | The type for the time counter which should be convertible to the | |
89 | <tt>value_type</tt> of the time property map | |
90 | </TD> | |
91 | <TD> </TD> | |
92 | </TR> | |
93 | ||
94 | ||
95 | <TR><TD><TT>EventTag</TT></TD> | |
96 | <TD> | |
97 | The tag to specify when the <tt>time_stamper</tt> should be | |
98 | applied during the graph algorithm. | |
99 | </TD> | |
100 | <TD> </TD> | |
101 | </TR> | |
102 | ||
103 | </table> | |
104 | ||
105 | <H2>Associated Types</H2> | |
106 | ||
107 | <table border> | |
108 | ||
109 | <tr> | |
110 | <th>Type</th><th>Description</th> | |
111 | </tr> | |
112 | ||
113 | <tr> | |
114 | <td><tt>time_stamper::event_filter</tt></td> | |
115 | <td> | |
116 | This will be the same type as the template parameter <tt>EventTag</tt>. | |
117 | </td> | |
118 | </tr> | |
119 | ||
120 | </table> | |
121 | ||
122 | <h3>Member Functions</h3> | |
123 | ||
124 | <p> | |
125 | ||
126 | <table border> | |
127 | <tr> | |
128 | <th>Member</th><th>Description</th> | |
129 | </tr> | |
130 | ||
131 | <tr> | |
132 | <td><tt> | |
133 | time_stamper(TimeMap time_pa, TimeT& t); | |
134 | </tt></td> | |
135 | <td> | |
136 | Construct a time stamper object with time property map | |
137 | <tt>time_pa</tt> and time counter <tt>t</tt>. | |
138 | </td> | |
139 | </tr> | |
140 | ||
141 | <tr> | |
142 | <td><tt> | |
143 | template <class X, class Graph><br> | |
144 | void operator()(X x, const Graph& g); | |
145 | </tt></td> | |
146 | <td> | |
147 | This increments the time count and "stamps" the time:<br> | |
148 | <tt>put(time_pa, x, ++t);</tt> | |
149 | </td> | |
150 | </tr> | |
151 | ||
152 | </table> | |
153 | ||
154 | <h3>Non-Member Functions</h3> | |
155 | ||
156 | <table border> | |
157 | <tr> | |
158 | <th>Function</th><th>Description</th> | |
159 | </tr> | |
160 | ||
161 | <tr><td><tt> | |
162 | template <class TimeMap, class TimeT, class Tag><br> | |
163 | time_stamper<TimeMap, TimeT, Tag><br> | |
164 | stamp_times(TimeMap pa, TimeT& t, Tag); | |
165 | </tt></td><td> | |
166 | A convenient way to create a <tt>time_stamper</tt>. | |
167 | </td></tr> | |
168 | ||
169 | </table> | |
170 | ||
171 | <h3>See Also</h3> | |
172 | ||
173 | <a href="./visitor_concepts.html">Visitor concepts</a> | |
174 | <p> | |
175 | The following are other event visitors: <a | |
176 | <a href="./distance_recorder.html"><tt>distance_recorder</tt></a>, | |
177 | <a href="./time_stamper.html"><tt>time_stamper</tt></a>, | |
178 | and <a href="./property_writer.html"><tt>property_writer</tt></a>. | |
179 | ||
180 | ||
181 | <br> | |
182 | <HR> | |
183 | <TABLE> | |
184 | <TR valign=top> | |
185 | <TD nowrap>Copyright © 2000-2001</TD><TD> | |
186 | <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>, | |
187 | Indiana University (<A | |
188 | HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br> | |
189 | <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> | |
190 | <A HREF="http://www.osl.iu.edu/~lums">Andrew Lumsdaine</A>, | |
191 | Indiana University (<A | |
192 | HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>) | |
193 | </TD></TR></TABLE> | |
194 | ||
195 | </BODY> | |
196 | </HTML> | |
197 | <!-- LocalWords: TimeMap TimeT EventTag EventVisitor bfs dfs EventVisitorList | |
198 | --> | |
199 | <!-- LocalWords: cpp num dtime ftime int WritablePropertyMap map | |
200 | --> | |
201 | <!-- LocalWords: const Siek Univ Quan Lumsdaine | |
202 | --> |