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