EventVisitor.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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: EventVisitor</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>EventVisitor Concept</H1>
  16. This concept defines the interface for single-event visitors. An
  17. EventVisitor has an apply member function (<tt>operator()</tt>) which
  18. is invoked within the graph algorithm at the event-point specified by
  19. the <tt>event_filter</tt> typedef within the
  20. EventVisitor. EventVisitor's can be combined into an <a
  21. href="./EventVisitorList.html">EventVistorList</a>.
  22. <p>
  23. The following is the list of event tags that can be invoked in BGL
  24. algorithms. Each tag corresponds to a member function of the visitor
  25. for an algorithm. For example, the <a
  26. href="./BFSVisitor.html">BFSVisitor</a> of <a
  27. href="./breadth_first_search.html"><tt>breadth_first_search()</tt></a>
  28. has a <tt>cycle_edge()</tt> member function. The corresponding tag is
  29. <tt>on_cycle_edge</tt>. The first argument is the event visitor's
  30. <tt>operator()</tt> must be either an edge or vertex descriptor
  31. depending on the event tag.
  32. <pre>
  33. namespace boost {
  34. struct on_initialize_vertex { };
  35. struct on_start_vertex { };
  36. struct on_discover_vertex { };
  37. struct on_examine_edge { };
  38. struct on_tree_edge { };
  39. struct on_cycle_edge { };
  40. struct on_finish_vertex { };
  41. struct on_forward_or_cross_edge { };
  42. struct on_back_edge { };
  43. struct on_edge_relaxed { };
  44. struct on_edge_not_relaxed { };
  45. struct on_edge_minimized { };
  46. struct on_edge_not_minimized { };
  47. } // namespace boost
  48. </pre>
  49. <h3>Refinement of</h3>
  50. <a href="../../utility/CopyConstructible.html">Copy Constructible</a>
  51. (copying a visitor should be a lightweight operation).
  52. <h3>Notation</h3>
  53. <Table>
  54. <TR>
  55. <TD><tt>G</tt></TD>
  56. <TD>A type that is a model of <a href="./Graph.html">Graph</a>.</TD>
  57. </TR>
  58. <TR>
  59. <TD><tt>g</tt></TD>
  60. <TD>An object of type <tt>G</tt>.</TD>
  61. </TR>
  62. <TR>
  63. <TD><tt>V</tt></TD>
  64. <TD>A type that is a model of EventVisitor.</TD>
  65. </TR>
  66. <TR>
  67. <TD><tt>vis</tt></TD>
  68. <TD>An object of type <tt>V</tt>.</TD>
  69. </TR>
  70. <TR>
  71. <TD><tt>x</tt></TD>
  72. <TD>An object of type
  73. <tt>boost::graph_traits&lt;G&gt;::vertex_descriptor</tt>
  74. or <tt>boost::graph_traits&lt;G&gt;::edge_descriptor</tt>.</TD>
  75. </TR>
  76. </table>
  77. <h3>Associated Types</h3>
  78. <Table border>
  79. <TR>
  80. <TD>Event Filter </TD>
  81. <TD><TT>V::event_filter</TT></TD>
  82. <TD>
  83. A tag struct to specify on which event the visitor should be invoked.
  84. </TD>
  85. </TR>
  86. </table>
  87. <h3>Valid Expressions</h3>
  88. <Table border>
  89. <tr>
  90. <th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
  91. </tr>
  92. <tr>
  93. <td>Apply Visitor</td>
  94. <td><TT>vis(x, g)</TT></TD>
  95. <TD><TT>void</TT></TD>
  96. <TD>
  97. Invokes the visitor operation on object <tt>x</tt>, which is
  98. either a vertex or edge descriptor of the graph.
  99. </TD>
  100. </TR>
  101. </table>
  102. <h3>Models</h3>
  103. <ul>
  104. <li><a
  105. href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a>
  106. <li><a href="./distance_recorder.html"><tt>distance_recorder</tt></a>
  107. <li><a href="./time_stamper.html"><tt>time_stamper</tt></a>
  108. <li><a href="./property_writer.html"><tt>property_writer</tt></a>
  109. <li><a href="./null_visitor.html"><tt>null_visitor</tt></a>
  110. </ul>
  111. <h3>See Also</h3>
  112. <a href="./EventVisitorList.html">EventVisitorList</a>,
  113. <a href="./visitor_concepts.html">Visitor concepts</a>
  114. <br>
  115. <HR>
  116. <TABLE>
  117. <TR valign=top>
  118. <TD nowrap>Copyright &copy; 2000-2001</TD><TD>
  119. <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>,
  120. Indiana University (<A
  121. HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br>
  122. <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>
  123. <A HREF="https://homes.cs.washington.edu/~al75">Andrew Lumsdaine</A>,
  124. Indiana University (<A
  125. HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>)
  126. </TD></TR></TABLE>
  127. </BODY>
  128. </HTML>