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 | |
---|
22 | This class can be used with the <a |
---|
23 | href="./adjacency_list.html"><tt>adjacency_list</tt></a> and the <a |
---|
24 | href="./adjacency_matrix.html"><tt>adjacency_matrix</tt></a> classes |
---|
25 | to specify what kind of properties should be attached to the vertices |
---|
26 | and edges of the graph, and to the graph object itself. |
---|
27 | |
---|
28 | |
---|
29 | <h3>Synopsis</h3> |
---|
30 | |
---|
31 | <pre> |
---|
32 | namespace 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 |
---|
60 | several predefined tags, and it is easy to add more. For convenience, |
---|
61 | BGL also provides predefined objects of the tag types (enum values) |
---|
62 | for use as arguments to functions that expect property tag objects |
---|
63 | (such as <tt>adjacency_list</tt>'s <a |
---|
64 | href="./adjacency_list.html#property-map-accessors"> property map |
---|
65 | accessor</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> |
---|
94 | next_type |
---|
95 | </pre> |
---|
96 | The <tt>NextProperty</tt> type parameter. |
---|
97 | |
---|
98 | <pre> |
---|
99 | tag_type |
---|
100 | </pre> |
---|
101 | The <tt>Tag</tt> type parameter. |
---|
102 | |
---|
103 | <pre> |
---|
104 | value_type |
---|
105 | </pre> |
---|
106 | The <tt>T</tt> type parameter. |
---|
107 | |
---|
108 | <hr> |
---|
109 | |
---|
110 | <H3>Member Functions</H3> |
---|
111 | |
---|
112 | <pre> |
---|
113 | property() |
---|
114 | </pre> |
---|
115 | |
---|
116 | Construct a property object with member <tt>m_value</tt> a default |
---|
117 | constructed instance of type <tt>T</tt> and with the super object |
---|
118 | default constructed. Note that <tt>T</tt> must be Default |
---|
119 | Constructible for this property, and all the inherited property types. |
---|
120 | |
---|
121 | <hr> |
---|
122 | |
---|
123 | <pre> |
---|
124 | property(const T& v) |
---|
125 | </pre> |
---|
126 | |
---|
127 | Construct a property object with member <tt>m_value</tt> a copy |
---|
128 | of <tt>v</tt>. |
---|
129 | |
---|
130 | <hr> |
---|
131 | |
---|
132 | <pre> |
---|
133 | property(const T& v, const NextProperty& b) |
---|
134 | </pre> |
---|
135 | |
---|
136 | Construct a property object with member <tt>m_value</tt> a copy |
---|
137 | of <tt>v</tt> and whose super class <tt>NextProperty</tt> is |
---|
138 | constructed from <tt>b</tt>. |
---|
139 | |
---|
140 | <hr> |
---|
141 | |
---|
142 | |
---|
143 | <h3>Property Tags</h3> |
---|
144 | |
---|
145 | The 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> |
---|