C++ Boost

time_stamper<TimeMap, TimeT, EventTag>

This is an EventVisitor that can be used to "stamp" a time at some event-point within an algorithm. An example of this is recording the discover or finish time of a vertex during a graph search.

time_stamper can be used with graph algorithms by wrapping it with the algorithm specific adaptor, such as bfs_visitor and dfs_visitor. Also, this event visitor can be combined with other event visitors using std::pair to form an EventVisitorList.

Example

The following example shows the usage of the time_stamper.
  std::vector color(num_vertices(G));
  std::vector dtime(num_vertices(G));
  std::vector ftime(num_vertices(G));

  int time = 0;
  boost::breadth_first_search
    (G, vertex(s, G), make_bfs_visitor(
     std::make_pair(stamp_times(dtime.begin(), time, on_discover_vertex()),
                    stamp_times(ftime.begin(), time, on_finish_vertex()))),
     color.begin());

Model of

EventVisitor

Where Defined

boost/graph/visitors.hpp

Template Parameters

ParameterDescriptionDefault
TimeMap A WritablePropertyMap, where the key_type is the vertex descriptor type or edge descriptor of the graph (depending on the kind of event tag), and where the TimeT type is convertible to the value_type of the time property map.  
TimeT The type for the time counter, which should be convertible to the value_type of the time property map  
EventTag The tag to specify when the time_stamper should be applied during the graph algorithm.  

Associated Types

TypeDescription
time_stamper::event_filter This will be the same type as the template parameter EventTag.

Member Functions

MemberDescription
time_stamper(TimeMap time_pa, TimeT& t); Construct a time stamper object with time property map time_pa and time counter t.
template <class X, class Graph>
void operator()(X x, const Graph& g);
This increments the time count and "stamps" the time:
put(time_pa, x, ++t);

Non-Member Functions

FunctionDescription
template <class TimeMap, class TimeT, class Tag>
time_stamper<TimeMap, TimeT, Tag>
stamp_times(TimeMap pa, TimeT& t, Tag);
A convenient way to create a time_stamper.

See Also

Visitor concepts

The following are other event visitors: distance_recorder, time_stamper, and property_writer.


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)