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> 20time_stamper<TimeMap, TimeT, EventTag> 21</pre> 22</H1> 23 24This is an <a href="./EventVisitor.html">EventVisitor</a> that can be 25used to "stamp" a time at some event-point within an 26algorithm. An example of this is recording the discover or finish time 27of a vertex during a graph search. 28 29<p> 30<tt>time_stamper</tt> can be used with graph algorithms by 31wrapping it with the algorithm specific adaptor, such as <a 32href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a 33href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event 34visitor can be combined with other event visitors using 35<tt>std::pair</tt> to form an EventVisitorList. 36 37<h3>Example</h3> 38 39The 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> 76A <a 77href="../../property_map/doc/WritablePropertyMap.html">WritablePropertyMap</a> 78where the <tt>key_type</tt> is the vertex descriptor type or edge 79descriptor of the graph (depending on the kind of event tag) and 80where 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> 88The 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> 97The tag to specify when the <tt>time_stamper</tt> should be 98applied 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> 116This 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> 133time_stamper(TimeMap time_pa, TimeT& t); 134</tt></td> 135<td> 136Construct 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> 143template <class X, class Graph><br> 144void operator()(X x, const Graph& g); 145</tt></td> 146<td> 147This 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> 162template <class TimeMap, class TimeT, class Tag><br> 163time_stamper<TimeMap, TimeT, Tag><br> 164stamp_times(TimeMap pa, TimeT& t, Tag); 165</tt></td><td> 166A 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> 175The 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>, 178and <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>, 187Indiana University (<A 188HREF="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="https://homes.cs.washington.edu/~al75">Andrew Lumsdaine</A>, 191Indiana University (<A 192HREF="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 --> 203