...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
property_writer<PropertyMap, OutputIterator, EventTag>
property_writer 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.
std::ostream_iteratorcout_int(std::cout, " "); std::ostream_iterator cout_char(std::cout, " "); boost::breadth_first_search (G, vertex(a, G), make_bfs_visitor( std::make_pair(write_property(name, cout_char, on_discover_vertex()), std::make_pair(write_property(distance.begin(), cout_int, on_discover_vertex()), std::make_pair(print_edge(name, std::cout, on_examine_edge()), print_endl(std::cout, on_finish_vertex() ))))));
Parameter | Description | Default |
---|---|---|
PropertyMap | A ReadablePropertyMap where the key_type is the vertex descriptor type or edge descriptor of the graph (depending on the kind of event tag) and the value_type of the property is convertible to the value_type of the OutputIterator. | |
OutputIterator | The iterator type used to write out the property values, which must be a model of OutputIterator. | |
EventTag | The tag to specify when the property_writer should be applied during the graph algorithm. |
Type | Description |
---|---|
property_writer::event_filter | This will be the same type as the template parameter EventTag. |
Member | Description |
---|---|
property_writer(PropertyMap pa, OutputIterator out); | Construct a property writer object with the property map pa and output iterator out. |
template <class X, class Graph> void operator()(X x, const Graph& g); |
This writes the property value for x to the output iterator. *out++ = get(pa, x); |
Function | Description |
---|---|
template <class PropertyMap, class OutputIterator, class Tag> property_writer<PropertyMap, OutputIterator, Tag> write_property(PropertyMap pa, OutputIterator out, Tag); | A convenient way to create a property_writer. |
The following are other event visitors: distance_recorder,
predecessor_recorder,
and time_stamper.
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) |