|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60196 - in trunk: boost/graph libs/graph/doc
From: jewillco_at_[hidden]
Date: 2010-03-05 12:44:17
Author: jewillco
Date: 2010-03-05 12:44:16 EST (Fri, 05 Mar 2010)
New Revision: 60196
URL: http://svn.boost.org/trac/boost/changeset/60196
Log:
Added property_put class from Matthias Walter
Added:
trunk/libs/graph/doc/property_put.html (contents, props changed)
Text files modified:
trunk/boost/graph/visitors.hpp | 46 ++++++++++++++++++++++++++++++++++++++++
trunk/libs/graph/doc/property_writer.html | 4 +-
trunk/libs/graph/doc/table_of_contents.html | 1
3 files changed, 49 insertions(+), 2 deletions(-)
Modified: trunk/boost/graph/visitors.hpp
==============================================================================
--- trunk/boost/graph/visitors.hpp (original)
+++ trunk/boost/graph/visitors.hpp 2010-03-05 12:44:16 EST (Fri, 05 Mar 2010)
@@ -251,6 +251,52 @@
return property_writer<PA, OutputIterator, Tag>(pa, out);
}
+ //========================================================================
+ // property_put
+
+ /**
+ * Functor which just sets a given value to a vertex or edge in a property map.
+ */
+
+ template <typename PropertyMap, typename EventTag>
+ struct property_put
+ {
+ typedef EventTag event_filter;
+
+ property_put (PropertyMap property_map,
+ typename property_traits <PropertyMap>::value_type value) :
+ property_map_ (property_map), value_ (value)
+ {}
+
+ template <typename VertexOrEdge, typename Graph>
+ void operator() (VertexOrEdge v, const Graph& g)
+ {
+ put (property_map_, v, value_);
+ }
+
+ private:
+ PropertyMap property_map_;
+ typename property_traits <PropertyMap>::value_type value_;
+ };
+
+ /**
+ * Creates a property_put functor which just sets a given value to a vertex or edge.
+ *
+ * @param property_map Given writeable property map
+ * @param value Fixed value of the map
+ * @param tag Event Filter
+ * @return The functor.
+ */
+
+ template <typename PropertyMap, typename EventTag>
+ inline property_put <PropertyMap, EventTag>
+ put_property (PropertyMap property_map,
+ typename property_traits <PropertyMap>::value_type value,
+ Tag tag)
+ {
+ return property_put <PropertyMap, Tag> (property_map, value);
+ }
+
#define BOOST_GRAPH_EVENT_STUB(Event,Kind) \
typedef ::boost::Event Event##_type; \
template<typename Visitor> \
Added: trunk/libs/graph/doc/property_put.html
==============================================================================
--- (empty file)
+++ trunk/libs/graph/doc/property_put.html 2010-03-05 12:44:16 EST (Fri, 05 Mar 2010)
@@ -0,0 +1,190 @@
+<HTML>
+<!--
+ Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
+ Copyright (c) 2010 Matthias Walter (xammy_at_[hidden])
+ Copyright (c) 2010 Trustees of Indiana University
+
+ 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_put</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>
+<pre>
+property_put<PropertyMap, EventTag>
+</pre>
+</H1>
+
+This is an EventVisitor that can be
+used to write a fixed value to a property map when a vertex or edge is
+visited at some event-point within an algorithm. For example, this
+visitor can be used as an alternative to a loop to initialize a
+property map, or it can be used to mark only back edges with a
+property.
+
+<p>
+<tt>property_put</tt> can be used with graph algorithms by
+wrapping it with the algorithm-specific adaptor, such as <a
+href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a
+href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event
+visitor can be combined with other event visitors using
+<tt>std::pair</tt> to form an EventVisitorList.
+
+<h3>Example</h3>
+
+<pre>
+ boost::depth_first_search
+ (G, boost::visitor(
+ boost::make_dfs_visitor(
+ boost::put_property(is_back_edge, boost::on_back_edge()))));
+</pre>
+
+<h3>Model of</h3>
+
+EventVisitor
+
+
+<H3>Where Defined</H3>
+
+<P>
+<a href="../../../boost/graph/visitors.hpp">
+<TT>boost/graph/visitors.hpp</TT></a>
+
+<H3>Template Parameters</H3>
+
+<P>
+<TABLE border>
+<TR>
+<th>Parameter</th><th>Description</th><th>Default</th>
+</tr>
+
+<TR><TD><TT>PropertyMap</TT></TD>
+<TD>
+A <a
+href="../../property_map/doc/WritablePropertyMap.html">WritablePropertyMap</a>,
+where the <tt>key_type</tt> is the vertex descriptor type or edge
+descriptor of the graph (depending on the kind of event tag).
+</TD>
+<TD> </TD>
+</TR>
+
+<TR><TD><TT>EventTag</TT></TD>
+<TD>
+The tag to specify when the <tt>property_put</tt> should be
+applied during the graph algorithm.
+</TD>
+<TD> </TD>
+</TR>
+
+</table>
+
+<H2>Associated Types</H2>
+
+<table border>
+
+<tr>
+<th>Type</th><th>Description</th>
+</tr>
+
+<tr>
+<td><tt>property_put::event_filter</tt></td>
+<td>
+This will be the same type as the template parameter <tt>EventTag</tt>.
+</td>
+</tr>
+
+</table>
+
+<h3>Member Functions</h3>
+
+<p>
+
+<table border>
+<tr>
+<th>Member</th><th>Description</th>
+</tr>
+
+<tr>
+<td><tt>
+property_put(PropertyMap pa, property_traits<PropertyMap>::value_type val);
+</tt></td>
+<td>
+Construct a property put object with the property map
+<tt>pa</tt> and constant value <tt>val</tt>.
+</td>
+</tr>
+
+<tr>
+<td><tt>
+template <class X, class Graph><br>
+void operator()(X x, const Graph& g);
+</tt></td>
+<td>
+This puts the value <tt>val</tt> into the property map for the vertex
+or edge <tt>x</tt>.<br>
+</td>
+</tr>
+
+</table>
+
+<h3>Non-Member Functions</h3>
+
+<table border>
+<tr>
+<th>Function</th><th>Description</th>
+</tr>
+
+<tr><td><tt>
+template <class PropertyMap, class EventTag><br>
+property_put<PropertyMap, EventTag><br>
+put_property(PropertyMap pa,
+ typename property_traits<PropertyMap>::value_type val,
+ EventTag);
+</tt></td><td>
+A convenient way to create a <tt>property_put</tt>.
+</td></tr>
+
+</table>
+
+<h3>See Also</h3>
+
+Visitor concepts
+<p>
+The following are other event visitors: <a
+distance_recorder,
+predecessor_recorder,
+and time_stamper.
+
+<br>
+<HR>
+<TABLE>
+<TR valign=top>
+<TD nowrap>Copyright © 2000-2001</TD><TD>
+Jeremy Siek,
+Indiana University (<A
+HREF="mailto:jsiek_at_[hidden]">jsiek_at_[hidden]</A>)<br>
+<A HREF="http://www.boost.org/people/liequan_lee.htm">Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee_at_[hidden]">llee_at_[hidden]</A>)<br>
+Andrew Lumsdaine,
+Indiana University (<A
+HREF="mailto:lums_at_[hidden]">lums_at_[hidden]</A>)
+</TD></TR>
+<tr><td>Copyright © 2010</td><td>Matthias Walter (<a href="mailto:xammy_at_[hidden]">xammy_at_[hidden]</a>)</td></tr>
+<tr><td></td><td>Trustees of Indiana University</td></tr>
+</TABLE>
+
+</BODY>
+</HTML>
+<!-- LocalWords: PropertyMap OutputIterator EventTag EventVisitor bfs dfs EventVisitorList
+ -->
+<!-- LocalWords: cpp num dtime ftime int WritablePropertyMap map adaptor
+ -->
+<!-- LocalWords: const Siek Univ Quan Lumsdaine typename
+ -->
Modified: trunk/libs/graph/doc/property_writer.html
==============================================================================
--- trunk/libs/graph/doc/property_writer.html (original)
+++ trunk/libs/graph/doc/property_writer.html 2010-03-05 12:44:16 EST (Fri, 05 Mar 2010)
@@ -27,7 +27,7 @@
<p>
<tt>property_writer</tt> can be used with graph algorithms by
-wrapping it with the algorithm specific adaptor, such as <a
+wrapping it with the algorithm-specific adaptor, such as <a
href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a
href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event
visitor can be combined with other event visitors using
@@ -145,7 +145,7 @@
void operator()(X x, const Graph& g);
</tt></td>
<td>
-This writs the property value for <tt>x</tt> to the output iterator.<br>
+This writes the property value for <tt>x</tt> to the output iterator.<br>
<tt>*out++ = get(pa, x);</tt>
</td>
</tr>
Modified: trunk/libs/graph/doc/table_of_contents.html
==============================================================================
--- trunk/libs/graph/doc/table_of_contents.html (original)
+++ trunk/libs/graph/doc/table_of_contents.html 2010-03-05 12:44:16 EST (Fri, 05 Mar 2010)
@@ -93,6 +93,7 @@
<LI>distance_recorder
<LI>time_stamper
<LI>property_writer
+ <LI>property_put
<li>tsp_tour_visitor</li>
<li>tsp_tour_len_visitor</li>
</OL>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk