property_writer.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <HTML>
  2. <!--
  3. Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
  4. Distributed under the Boost Software License, Version 1.0.
  5. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. -->
  8. <Head>
  9. <Title>Boost Graph Library: property_writer</Title>
  10. <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
  11. ALINK="#ff0000">
  12. <IMG SRC="../../../boost.png"
  13. ALT="C++ Boost" width="277" height="86">
  14. <BR Clear>
  15. <H1>
  16. <pre>
  17. property_writer&lt;PropertyMap, OutputIterator, EventTag&gt;
  18. </pre>
  19. </H1>
  20. This is an <a href="./EventVisitor.html">EventVisitor</a> that can be
  21. used to output the property of a vertex or edge at some event-point
  22. within an algorithm.
  23. <p>
  24. <tt>property_writer</tt> can be used with graph algorithms by
  25. wrapping it with the algorithm-specific adaptor, such as <a
  26. href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a
  27. href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event
  28. visitor can be combined with other event visitors using
  29. <tt>std::pair</tt> to form an EventVisitorList.
  30. <h3>Example</h3>
  31. The following is an excerpt from <a
  32. href="../example/dave.cpp"><tt>examples/dave.cpp</tt></a>.
  33. <pre>
  34. std::ostream_iterator<int> cout_int(std::cout, " ");
  35. std::ostream_iterator<char> cout_char(std::cout, " ");
  36. boost::breadth_first_search
  37. (G, vertex(a, G), make_bfs_visitor(
  38. std::make_pair(write_property(name, cout_char, on_discover_vertex()),
  39. std::make_pair(write_property(distance.begin(), cout_int,
  40. on_discover_vertex()),
  41. std::make_pair(print_edge(name, std::cout, on_examine_edge()),
  42. print_endl(std::cout, on_finish_vertex()
  43. ))))));
  44. </pre>
  45. <h3>Model of</h3>
  46. <a href="./EventVisitor.html">EventVisitor</a>
  47. <H3>Where Defined</H3>
  48. <P>
  49. <a href="../../../boost/graph/visitors.hpp">
  50. <TT>boost/graph/visitors.hpp</TT></a>
  51. <H3>Template Parameters</H3>
  52. <P>
  53. <TABLE border>
  54. <TR>
  55. <th>Parameter</th><th>Description</th><th>Default</th>
  56. </tr>
  57. <TR><TD><TT>PropertyMap</TT></TD>
  58. <TD>
  59. A <a
  60. href="../../property_map/doc/ReadablePropertyMap.html">ReadablePropertyMap</a>
  61. where the <tt>key_type</tt> is the vertex descriptor type or edge
  62. descriptor of the graph (depending on the kind of event tag) and
  63. the <tt>value_type</tt> of the property is convertible
  64. to the <tt>value_type</tt> of the <tt>OutputIterator</tt>.
  65. </TD>
  66. <TD>&nbsp;</TD>
  67. </TR>
  68. <TR><TD><TT>OutputIterator</TT></TD>
  69. <TD>
  70. The iterator type used to write out the property values, which must be
  71. a model of <a
  72. href="http://www.boost.org/sgi/stl/OutputIterator.html">OutputIterator</a>.
  73. </TD>
  74. <TD>&nbsp;</TD>
  75. </TR>
  76. <TR><TD><TT>EventTag</TT></TD>
  77. <TD>
  78. The tag to specify when the <tt>property_writer</tt> should be
  79. applied during the graph algorithm.
  80. </TD>
  81. <TD>&nbsp;</TD>
  82. </TR>
  83. </table>
  84. <H2>Associated Types</H2>
  85. <table border>
  86. <tr>
  87. <th>Type</th><th>Description</th>
  88. </tr>
  89. <tr>
  90. <td><tt>property_writer::event_filter</tt></td>
  91. <td>
  92. This will be the same type as the template parameter <tt>EventTag</tt>.
  93. </td>
  94. </tr>
  95. </table>
  96. <h3>Member Functions</h3>
  97. <p>
  98. <table border>
  99. <tr>
  100. <th>Member</th><th>Description</th>
  101. </tr>
  102. <tr>
  103. <td><tt>
  104. property_writer(PropertyMap pa, OutputIterator out);
  105. </tt></td>
  106. <td>
  107. Construct a property writer object with the property map
  108. <tt>pa</tt> and output iterator <tt>out</tt>.
  109. </td>
  110. </tr>
  111. <tr>
  112. <td><tt>
  113. template &lt;class X, class Graph&gt;<br>
  114. void operator()(X x, const Graph& g);
  115. </tt></td>
  116. <td>
  117. This writes the property value for <tt>x</tt> to the output iterator.<br>
  118. <tt>*out++ = get(pa, x);</tt>
  119. </td>
  120. </tr>
  121. </table>
  122. <h3>Non-Member Functions</h3>
  123. <table border>
  124. <tr>
  125. <th>Function</th><th>Description</th>
  126. </tr>
  127. <tr><td><tt>
  128. template &lt;class PropertyMap, class OutputIterator, class Tag&gt;<br>
  129. property_writer&lt;PropertyMap, OutputIterator, Tag&gt;<br>
  130. write_property(PropertyMap pa, OutputIterator out, Tag);
  131. </tt></td><td>
  132. A convenient way to create a <tt>property_writer</tt>.
  133. </td></tr>
  134. </table>
  135. <h3>See Also</h3>
  136. <a href="./visitor_concepts.html">Visitor concepts</a>
  137. <p>
  138. The following are other event visitors: <a
  139. <a href="./distance_recorder.html"><tt>distance_recorder</tt></a>,
  140. <a href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a>,
  141. and <a href="./time_stamper.html"><tt>time_stamper</tt></a>.
  142. <br>
  143. <HR>
  144. <TABLE>
  145. <TR valign=top>
  146. <TD nowrap>Copyright &copy; 2000-2001</TD><TD>
  147. <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>,
  148. Indiana University (<A
  149. HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br>
  150. <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>
  151. <A HREF="https://homes.cs.washington.edu/~al75">Andrew Lumsdaine</A>,
  152. Indiana University (<A
  153. HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>)
  154. </TD></TR></TABLE>
  155. </BODY>
  156. </HTML>
  157. <!-- LocalWords: PropertyMap OutputIterator EventTag EventVisitor bfs dfs EventVisitorList
  158. -->
  159. <!-- LocalWords: cpp num dtime ftime int WritablePropertyMap map
  160. -->
  161. <!-- LocalWords: const Siek Univ Quan Lumsdaine
  162. -->