property.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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</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><A NAME="sec:property"></A>
  16. <TT>property&lt;PropertyTag, T, NextProperty&gt;</TT>
  17. </H1>
  18. This class can be used with the <a
  19. href="./adjacency_list.html"><tt>adjacency_list</tt></a> and the <a
  20. href="./adjacency_matrix.html"><tt>adjacency_matrix</tt></a> classes
  21. to specify what kind of properties should be attached to the vertices
  22. and edges of the graph, and to the graph object itself.
  23. <h3>Synopsis</h3>
  24. <pre>
  25. namespace boost {
  26. template &lt;class Tag, class T, class NextProperty = no_property&gt;
  27. struct property : public NextProperty {
  28. typedef NextProperty next_type;
  29. typedef Tag tag_type;
  30. typedef T value_type;
  31. property();
  32. property(const T&amp; v);
  33. property(const T&amp; v, const NextProperty&amp; b);
  34. // copy constructor and assignment operator will be generated by compiler
  35. T m_value;
  36. };
  37. }
  38. </pre>
  39. <h3>Template Parameters</h3>
  40. <P>
  41. <TABLE border>
  42. <TR>
  43. <th>Parameter</th><th>Description</th><th>Default</th>
  44. </tr>
  45. <tr>
  46. <td><tt>PropertyTag</tt></td>
  47. <td>A type to identify (give a unique name to) the property. There are
  48. several predefined tags, and it is easy to add more. For convenience,
  49. BGL also provides predefined objects of the tag types (enum values)
  50. for use as arguments to functions that expect property tag objects
  51. (such as <tt>adjacency_list</tt>'s <a
  52. href="./adjacency_list.html#property-map-accessors"> property map
  53. accessor</a> functions). </td>
  54. <td>&nbsp;</td>
  55. </tr>
  56. <tr>
  57. <td><tt>T</tt></td>
  58. <td> This type specifies the type of the property values. </td>
  59. <td>&nbsp;</td>
  60. </tr>
  61. <tr>
  62. <td><tt>NextProperty</tt></td>
  63. <td>This parameter allows <tt>property</tt> types to be
  64. nested, so that an arbitrary number of properties can be attached to
  65. the same graph.</td>
  66. <td><tt>no_property</tt></td>
  67. </tr>
  68. </table>
  69. <h3>Where Defined</h3>
  70. <a href="../../../boost/pending/property.hpp"><tt>boost/pending/property.hpp</tt></a>
  71. <hr>
  72. <H3>Associated Types</H3>
  73. <pre>
  74. next_type
  75. </pre>
  76. The <tt>NextProperty</tt> type parameter.
  77. <pre>
  78. tag_type
  79. </pre>
  80. The <tt>Tag</tt> type parameter.
  81. <pre>
  82. value_type
  83. </pre>
  84. The <tt>T</tt> type parameter.
  85. <hr>
  86. <H3>Member Functions</H3>
  87. <pre>
  88. property()
  89. </pre>
  90. Construct a property object with member <tt>m_value</tt> a default
  91. constructed instance of type <tt>T</tt> and with the super object
  92. default constructed. Note that <tt>T</tt> must be Default
  93. Constructible for this property, and all the inherited property types.
  94. <hr>
  95. <pre>
  96. property(const T& v)
  97. </pre>
  98. Construct a property object with member <tt>m_value</tt> a copy
  99. of <tt>v</tt>.
  100. <hr>
  101. <pre>
  102. property(const T& v, const NextProperty& b)
  103. </pre>
  104. Construct a property object with member <tt>m_value</tt> a copy
  105. of <tt>v</tt> and whose super class <tt>NextProperty</tt> is
  106. constructed from <tt>b</tt>.
  107. <hr>
  108. <h3>Property Tags</h3>
  109. The following property tags are defined in
  110. <tt>boost/graph/properties.hpp</tt>.
  111. <pre>
  112. namespace boost {
  113. enum edge_name_t { edge_name };
  114. enum edge_weight_t { edge_weight };
  115. enum edge_index_t { edge_index };
  116. enum edge_capacity_t { edge_capacity };
  117. enum edge_residual_capacity_t { edge_residual_capacity };
  118. enum edge_reverse_t { edge_reverse };
  119. enum vertex_name_t { vertex_name };
  120. enum vertex_distance_t { vertex_distance };
  121. enum vertex_index_t { vertex_index };
  122. enum vertex_color_t { vertex_color };
  123. enum vertex_degree_t { vertex_degree };
  124. enum vertex_out_degree_t { vertex_out_degree };
  125. enum vertex_in_degree_t { vertex_in_degree };
  126. enum vertex_discover_time_t { vertex_discover_time };
  127. enum vertex_finish_time_t { vertex_finish_time };
  128. enum graph_name_t { graph_name };
  129. BOOST_INSTALL_PROPERTY(vertex, index);
  130. BOOST_INSTALL_PROPERTY(edge, index);
  131. // ...
  132. }
  133. </pre>