|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86604 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2013-11-09 14:06:06
Author: jewillco
Date: 2013-11-09 14:06:06 EST (Sat, 09 Nov 2013)
New Revision: 86604
URL: http://svn.boost.org/trac/boost/changeset/86604
Log:
Added graph property support to write_graphviz_dp
Text files modified:
trunk/boost/graph/graphviz.hpp | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
Modified: trunk/boost/graph/graphviz.hpp
==============================================================================
--- trunk/boost/graph/graphviz.hpp Sat Nov 9 14:04:41 2013 (r86603)
+++ trunk/boost/graph/graphviz.hpp 2013-11-09 14:06:06 EST (Sat, 09 Nov 2013) (r86604)
@@ -536,6 +536,28 @@
const std::string* node_id;
};
+ template <typename Graph>
+ class dynamic_graph_properties_writer
+ {
+ public:
+ dynamic_graph_properties_writer(const dynamic_properties& dp, const Graph& g) : g(&g), dp(&dp) { }
+
+ void operator()(std::ostream& out) const
+ {
+ for (dynamic_properties::const_iterator i = dp->begin();
+ i != dp->end(); ++i) {
+ if (typeid(Graph*) == i->second->key()) {
+ // const_cast here is to match interface used in read_graphviz
+ out << i->first << "=" << escape_dot_string(i->second->get_string(const_cast<Graph*>(g))) << ";\n";
+ }
+ }
+ }
+
+ private:
+ const Graph* g;
+ const dynamic_properties* dp;
+ };
+
namespace graph { namespace detail {
template<typename Vertex>
@@ -587,7 +609,7 @@
(out, g,
/*vertex_writer=*/dynamic_vertex_properties_writer(dp, node_id),
/*edge_writer=*/dynamic_properties_writer(dp),
- /*graph_writer=*/default_writer(),
+ /*graph_writer=*/dynamic_graph_properties_writer<Graph>(dp, g),
id);
}
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