Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77341 - trunk/boost/graph
From: jewillco_at_[hidden]
Date: 2012-03-15 13:39:15


Author: jewillco
Date: 2012-03-15 13:39:14 EDT (Thu, 15 Mar 2012)
New Revision: 77341
URL: http://svn.boost.org/trac/boost/changeset/77341

Log:
Changed type of graph property keys to Graph* to match Graphviz reader code and test
Text files modified:
   trunk/boost/graph/graphml.hpp | 10 ++++++----
   1 files changed, 6 insertions(+), 4 deletions(-)

Modified: trunk/boost/graph/graphml.hpp
==============================================================================
--- trunk/boost/graph/graphml.hpp (original)
+++ trunk/boost/graph/graphml.hpp 2012-03-15 13:39:14 EDT (Thu, 15 Mar 2012)
@@ -262,7 +262,7 @@
     for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
     {
         std::string key_id = "key" + lexical_cast<std::string>(key_count++);
- if (i->second->key() == typeid(Graph))
+ if (i->second->key() == typeid(Graph*))
             graph_key_ids[i->first] = key_id;
         else if (i->second->key() == typeid(vertex_descriptor))
             vertex_key_ids[i->first] = key_id;
@@ -273,7 +273,7 @@
         std::string type_name = "string";
         mpl::for_each<value_types>(get_type_name<value_types>(i->second->value(), type_names, type_name));
         out << " <key id=\"" << encode_char_entities(key_id) << "\" for=\""
- << (i->second->key() == typeid(Graph) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\""
+ << (i->second->key() == typeid(Graph*) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\""
             << " attr.name=\"" << i->first << "\""
             << " attr.type=\"" << type_name << "\""
             << " />\n";
@@ -287,10 +287,12 @@
     // Output graph data
     for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
     {
- if (i->second->key() == typeid(Graph))
+ if (i->second->key() == typeid(Graph*))
         {
+ // The const_cast here is just to get typeid correct for property
+ // map key; the graph should not be mutated using it.
             out << " <data key=\"" << graph_key_ids[i->first] << "\">"
- << encode_char_entities(i->second->get_string(g)) << "</data>\n";
+ << encode_char_entities(i->second->get_string(const_cast<Graph*>(&g))) << "</data>\n";
         }
     }
 


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