1<HTML> 2<!-- 3 Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000 4 5 Distributed under the Boost Software License, Version 1.0. 6 (See accompanying file LICENSE_1_0.txt or copy at 7 http://www.boost.org/LICENSE_1_0.txt) 8 --> 9<Head> 10<Title>Boost Graph Library: Property</Title> 11<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 12 ALINK="#ff0000"> 13<IMG SRC="../../../boost.png" 14 ALT="C++ Boost" width="277" height="86"> 15 16<BR Clear> 17 18<H1><A NAME="sec:property"></A> 19<TT>property<PropertyTag, T, NextProperty></TT> 20</H1> 21 22This class can be used with the <a 23href="./adjacency_list.html"><tt>adjacency_list</tt></a> and the <a 24href="./adjacency_matrix.html"><tt>adjacency_matrix</tt></a> classes 25to specify what kind of properties should be attached to the vertices 26and edges of the graph, and to the graph object itself. 27 28 29<h3>Synopsis</h3> 30 31<pre> 32namespace boost { 33 template <class Tag, class T, class NextProperty = no_property> 34 struct property : public NextProperty { 35 typedef NextProperty next_type; 36 typedef Tag tag_type; 37 typedef T value_type; 38 property(); 39 property(const T& v); 40 property(const T& v, const NextProperty& b); 41 // copy constructor and assignment operator will be generated by compiler 42 T m_value; 43 }; 44} 45</pre> 46 47<h3>Template Parameters</h3> 48 49 50<P> 51<TABLE border> 52<TR> 53<th>Parameter</th><th>Description</th><th>Default</th> 54</tr> 55 56<tr> 57<td><tt>PropertyTag</tt></td> 58 59<td>A type to identify (give a unique name to) the property. There are 60several predefined tags, and it is easy to add more. For convenience, 61BGL also provides predefined objects of the tag types (enum values) 62for use as arguments to functions that expect property tag objects 63(such as <tt>adjacency_list</tt>'s <a 64href="./adjacency_list.html#property-map-accessors"> property map 65accessor</a> functions). </td> 66 67<td> </td> 68</tr> 69 70<tr> 71<td><tt>T</tt></td> 72<td> This type specifies the type of the property values. </td> 73<td> </td> 74</tr> 75 76<tr> 77<td><tt>NextProperty</tt></td> 78<td>This parameter allows <tt>property</tt> types to be 79 nested, so that an arbitrary number of properties can be attached to 80 the same graph.</td> 81<td><tt>no_property</tt></td> 82</tr> 83</table> 84 85<h3>Where Defined</h3> 86 87<a href="../../../boost/pending/property.hpp"><tt>boost/pending/property.hpp</tt></a> 88 89<hr> 90 91<H3>Associated Types</H3> 92 93<pre> 94next_type 95</pre> 96The <tt>NextProperty</tt> type parameter. 97 98<pre> 99tag_type 100</pre> 101The <tt>Tag</tt> type parameter. 102 103<pre> 104value_type 105</pre> 106The <tt>T</tt> type parameter. 107 108<hr> 109 110<H3>Member Functions</H3> 111 112<pre> 113property() 114</pre> 115 116Construct a property object with member <tt>m_value</tt> a default 117constructed instance of type <tt>T</tt> and with the super object 118default constructed. Note that <tt>T</tt> must be Default 119Constructible for this property, and all the inherited property types. 120 121<hr> 122 123<pre> 124property(const T& v) 125</pre> 126 127Construct a property object with member <tt>m_value</tt> a copy 128of <tt>v</tt>. 129 130<hr> 131 132<pre> 133property(const T& v, const NextProperty& b) 134</pre> 135 136Construct a property object with member <tt>m_value</tt> a copy 137of <tt>v</tt> and whose super class <tt>NextProperty</tt> is 138constructed from <tt>b</tt>. 139 140<hr> 141 142 143<h3>Property Tags</h3> 144 145The following property tags are defined in 146<tt>boost/graph/properties.hpp</tt>. 147 148<pre> 149 namespace boost { 150 enum edge_name_t { edge_name }; 151 enum edge_weight_t { edge_weight }; 152 enum edge_index_t { edge_index }; 153 enum edge_capacity_t { edge_capacity }; 154 enum edge_residual_capacity_t { edge_residual_capacity }; 155 enum edge_reverse_t { edge_reverse }; 156 enum vertex_name_t { vertex_name }; 157 enum vertex_distance_t { vertex_distance }; 158 enum vertex_index_t { vertex_index }; 159 enum vertex_color_t { vertex_color }; 160 enum vertex_degree_t { vertex_degree }; 161 enum vertex_out_degree_t { vertex_out_degree }; 162 enum vertex_in_degree_t { vertex_in_degree }; 163 enum vertex_discover_time_t { vertex_discover_time }; 164 enum vertex_finish_time_t { vertex_finish_time }; 165 enum graph_name_t { graph_name }; 166 167 BOOST_INSTALL_PROPERTY(vertex, index); 168 BOOST_INSTALL_PROPERTY(edge, index); 169 // ... 170 } 171</pre> 172