blob: 3894a282ca8562895b574bc60f3ba70deea55063 [file] [log] [blame]
<HTML>
<!--
Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<Head>
<Title>Boost Graph Library: Property</Title>
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
ALINK="#ff0000">
<IMG SRC="../../../boost.png"
ALT="C++ Boost" width="277" height="86">
<BR Clear>
<H1><A NAME="sec:property"></A>
<TT>property&lt;PropertyTag, T, NextProperty&gt;</TT>
</H1>
This class can be used with the <a
href="./adjacency_list.html"><tt>adjacency_list</tt></a> and the <a
href="./adjacency_matrix.html"><tt>adjacency_matrix</tt></a> classes
to specify what kind of properties should be attached to the vertices
and edges of the graph, and to the graph object itself.
<h3>Synopsis</h3>
<pre>
namespace boost {
template &lt;class Tag, class T, class NextProperty = no_property&gt;
struct property : public NextProperty {
typedef NextProperty next_type;
typedef Tag tag_type;
typedef T value_type;
property();
property(const T&amp; v);
property(const T&amp; v, const NextProperty&amp; b);
// copy constructor and assignment operator will be generated by compiler
T m_value;
};
}
</pre>
<h3>Template Parameters</h3>
<P>
<TABLE border>
<TR>
<th>Parameter</th><th>Description</th><th>Default</th>
</tr>
<tr>
<td><tt>PropertyTag</tt></td>
<td>A type to identify (give a unique name to) the property. There are
several predefined tags, and it is easy to add more. For convenience,
BGL also provides predefined objects of the tag types (enum values)
for use as arguments to functions that expect property tag objects
(such as <tt>adjacency_list</tt>'s <a
href="./adjacency_list.html#property-map-accessors"> property map
accessor</a> functions). </td>
<td>&nbsp;</td>
</tr>
<tr>
<td><tt>T</tt></td>
<td> This type specifies the type of the property values. </td>
<td>&nbsp;</td>
</tr>
<tr>
<td><tt>NextProperty</tt></td>
<td>This parameter allows <tt>property</tt> types to be
nested, so that an arbitrary number of properties can be attached to
the same graph.</td>
<td><tt>no_property</tt></td>
</tr>
</table>
<h3>Where Defined</h3>
<a href="../../../boost/pending/property.hpp"><tt>boost/pending/property.hpp</tt></a>
<hr>
<H3>Associated Types</H3>
<pre>
next_type
</pre>
The <tt>NextProperty</tt> type parameter.
<pre>
tag_type
</pre>
The <tt>Tag</tt> type parameter.
<pre>
value_type
</pre>
The <tt>T</tt> type parameter.
<hr>
<H3>Member Functions</H3>
<pre>
property()
</pre>
Construct a property object with member <tt>m_value</tt> a default
constructed instance of type <tt>T</tt> and with the super object
default constructed. Note that <tt>T</tt> must be Default
Constructible for this property, and all the inherited property types.
<hr>
<pre>
property(const T& v)
</pre>
Construct a property object with member <tt>m_value</tt> a copy
of <tt>v</tt>.
<hr>
<pre>
property(const T& v, const NextProperty& b)
</pre>
Construct a property object with member <tt>m_value</tt> a copy
of <tt>v</tt> and whose super class <tt>NextProperty</tt> is
constructed from <tt>b</tt>.
<hr>
<h3>Property Tags</h3>
The following property tags are defined in
<tt>boost/graph/properties.hpp</tt>.
<pre>
namespace boost {
enum edge_name_t { edge_name };
enum edge_weight_t { edge_weight };
enum edge_index_t { edge_index };
enum edge_capacity_t { edge_capacity };
enum edge_residual_capacity_t { edge_residual_capacity };
enum edge_reverse_t { edge_reverse };
enum vertex_name_t { vertex_name };
enum vertex_distance_t { vertex_distance };
enum vertex_index_t { vertex_index };
enum vertex_color_t { vertex_color };
enum vertex_degree_t { vertex_degree };
enum vertex_out_degree_t { vertex_out_degree };
enum vertex_in_degree_t { vertex_in_degree };
enum vertex_discover_time_t { vertex_discover_time };
enum vertex_finish_time_t { vertex_finish_time };
enum graph_name_t { graph_name };
BOOST_INSTALL_PROPERTY(vertex, index);
BOOST_INSTALL_PROPERTY(edge, index);
// ...
}
</pre>