Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58876 - in trunk: boost/graph boost/property_map libs/graph/src
From: jewillco_at_[hidden]
Date: 2010-01-10 13:54:02


Author: jewillco
Date: 2010-01-10 13:54:01 EST (Sun, 10 Jan 2010)
New Revision: 58876
URL: http://svn.boost.org/trac/boost/changeset/58876

Log:
Changed to BOOST_THROW_EXCEPTION (except in one test case)
Text files modified:
   trunk/boost/graph/astar_search.hpp | 3 ++-
   trunk/boost/graph/graphml.hpp | 37 +++++++++++++++++++++++++------------
   trunk/boost/graph/gursoy_atun_layout.hpp | 3 ++-
   trunk/boost/graph/metric_tsp_approx.hpp | 4 ++--
   trunk/boost/graph/topological_sort.hpp | 3 ++-
   trunk/boost/property_map/dynamic_property_map.hpp | 11 ++++++-----
   trunk/libs/graph/src/graphml.cpp | 14 ++++++++++----
   7 files changed, 49 insertions(+), 26 deletions(-)

Modified: trunk/boost/graph/astar_search.hpp
==============================================================================
--- trunk/boost/graph/astar_search.hpp (original)
+++ trunk/boost/graph/astar_search.hpp 2010-01-10 13:54:01 EST (Sun, 10 Jan 2010)
@@ -17,6 +17,7 @@
 #include <functional>
 #include <vector>
 #include <boost/limits.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/graph/named_function_params.hpp>
 #include <boost/graph/relax.hpp>
 #include <boost/graph/exception.hpp>
@@ -147,7 +148,7 @@
       template <class Edge, class Graph>
       void examine_edge(Edge e, Graph& g) {
         if (m_compare(get(m_weight, e), m_zero))
- throw negative_edge();
+ BOOST_THROW_EXCEPTION(negative_edge());
         m_vis.examine_edge(e, g);
       }
       template <class Edge, class Graph>

Modified: trunk/boost/graph/graphml.hpp
==============================================================================
--- trunk/boost/graph/graphml.hpp (original)
+++ trunk/boost/graph/graphml.hpp 2010-01-10 13:54:01 EST (Sun, 10 Jan 2010)
@@ -24,6 +24,7 @@
 #include <boost/mpl/find.hpp>
 #include <boost/mpl/for_each.hpp>
 #include <boost/property_tree/detail/xml_parser_utils.hpp>
+#include <boost/throw_exception.hpp>
 #include <exception>
 #include <sstream>
 
@@ -101,12 +102,16 @@
         }
         catch (bad_lexical_cast)
         {
- throw parse_error("invalid value \"" + value + "\" for key " +
- name + " of type " + value_type);
+ BOOST_THROW_EXCEPTION(
+ parse_error("invalid value \"" + value + "\" for key " +
+ name + " of type " + value_type));
         }
         if (!type_found)
- throw parse_error("unrecognized type \"" + value_type +
- "\" for key " + name);
+ {
+ BOOST_THROW_EXCEPTION(
+ parse_error("unrecognized type \"" + value_type +
+ "\" for key " + name));
+ }
 
     }
 
@@ -122,12 +127,16 @@
         }
         catch (bad_lexical_cast)
         {
- throw parse_error("invalid value \"" + value + "\" for key " +
- name + " of type " + value_type);
+ BOOST_THROW_EXCEPTION(
+ parse_error("invalid value \"" + value + "\" for key " +
+ name + " of type " + value_type));
         }
         if (!type_found)
- throw parse_error("unrecognized type \"" + value_type +
- "\" for key " + name);
+ {
+ BOOST_THROW_EXCEPTION(
+ parse_error("unrecognized type \"" + value_type +
+ "\" for key " + name));
+ }
 
     }
 
@@ -143,12 +152,16 @@
         }
         catch (bad_lexical_cast)
         {
- throw parse_error("invalid value \"" + value + "\" for key " +
- name + " of type " + value_type);
+ BOOST_THROW_EXCEPTION(
+ parse_error("invalid value \"" + value + "\" for key " +
+ name + " of type " + value_type));
         }
         if (!type_found)
- throw parse_error("unrecognized type \"" + value_type +
- "\" for key " + name);
+ {
+ BOOST_THROW_EXCEPTION(
+ parse_error("unrecognized type \"" + value_type +
+ "\" for key " + name));
+ }
     }
 
     template <typename Key, typename ValueVector>

Modified: trunk/boost/graph/gursoy_atun_layout.hpp
==============================================================================
--- trunk/boost/graph/gursoy_atun_layout.hpp (original)
+++ trunk/boost/graph/gursoy_atun_layout.hpp 2010-01-10 13:54:01 EST (Sun, 10 Jan 2010)
@@ -16,6 +16,7 @@
 // http://springerlink.metapress.com/link.asp?id=pcu07ew5rhexp9yt
 
 #include <boost/config/no_tr1/cmath.hpp>
+#include <boost/throw_exception.hpp>
 #include <vector>
 #include <exception>
 #include <algorithm>
@@ -72,7 +73,7 @@
 #endif
 
     if (get(node_distance, v) > distance_limit)
- throw over_distance_limit();
+ BOOST_THROW_EXCEPTION(over_distance_limit());
     Point old_position = get(position_map, v);
     double distance = get(node_distance, v);
     double fraction =

Modified: trunk/boost/graph/metric_tsp_approx.hpp
==============================================================================
--- trunk/boost/graph/metric_tsp_approx.hpp (original)
+++ trunk/boost/graph/metric_tsp_approx.hpp 2010-01-10 13:54:01 EST (Sun, 10 Jan 2010)
@@ -35,7 +35,7 @@
 #include <boost/graph/adjacency_list.hpp>
 #include <boost/graph/prim_minimum_spanning_tree.hpp>
 #include <boost/graph/lookup_edge.hpp>
-
+#include <boost/throw_exception.hpp>
 
 namespace boost
 {
@@ -287,7 +287,7 @@
                 bool found;
                 tie(e, found) = lookup_edge(previous_, v, g);
                 if(!found) {
- throw not_complete();
+ BOOST_THROW_EXCEPTION(not_complete());
                 }
 
                 tourlen_ += wmap_[e];

Modified: trunk/boost/graph/topological_sort.hpp
==============================================================================
--- trunk/boost/graph/topological_sort.hpp (original)
+++ trunk/boost/graph/topological_sort.hpp 2010-01-10 13:54:01 EST (Sun, 10 Jan 2010)
@@ -16,6 +16,7 @@
 #include <boost/graph/depth_first_search.hpp>
 #include <boost/graph/visitors.hpp>
 #include <boost/graph/exception.hpp>
+#include <boost/throw_exception.hpp>
 
 namespace boost {
 
@@ -37,7 +38,7 @@
       : m_iter(_iter) { }
     
     template <typename Edge, typename Graph>
- void back_edge(const Edge&, Graph&) { throw not_a_dag(); }
+ void back_edge(const Edge&, Graph&) { BOOST_THROW_EXCEPTION(not_a_dag()); }
     
     template <typename Vertex, typename Graph>
     void finish_vertex(const Vertex& u, Graph&) { *m_iter++ = u; }

Modified: trunk/boost/property_map/dynamic_property_map.hpp
==============================================================================
--- trunk/boost/property_map/dynamic_property_map.hpp (original)
+++ trunk/boost/property_map/dynamic_property_map.hpp 2010-01-10 13:54:01 EST (Sun, 10 Jan 2010)
@@ -18,6 +18,7 @@
 
 
 #include <boost/config.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/property_map/property_map.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/any.hpp>
@@ -165,7 +166,7 @@
 
   void do_put(const any&, const any&, mpl::bool_<false>)
   {
- throw dynamic_const_put_error();
+ BOOST_THROW_EXCEPTION(dynamic_const_put_error());
   }
 
 public:
@@ -281,7 +282,7 @@
   generate(const std::string& name, const Key& key, const Value& value)
   {
     if(!generate_fn) {
- throw property_not_found(name);
+ BOOST_THROW_EXCEPTION(property_not_found(name));
     } else {
       return generate_fn(name,key,value);
     }
@@ -326,7 +327,7 @@
       return any_cast<Value>(i->second->get(key));
   }
 
- throw dynamic_get_failure(name);
+ BOOST_THROW_EXCEPTION(dynamic_get_failure(name));
 }
 #endif
 
@@ -340,7 +341,7 @@
       return any_cast<Value>(i->second->get(key));
   }
 
- throw dynamic_get_failure(name);
+ BOOST_THROW_EXCEPTION(dynamic_get_failure(name));
 }
 
 template<typename Key>
@@ -353,7 +354,7 @@
       return i->second->get_string(key);
   }
 
- throw dynamic_get_failure(name);
+ BOOST_THROW_EXCEPTION(dynamic_get_failure(name));
 }
 
 // The easy way to ignore properties.

Modified: trunk/libs/graph/src/graphml.cpp
==============================================================================
--- trunk/libs/graph/src/graphml.cpp (original)
+++ trunk/libs/graph/src/graphml.cpp 2010-01-10 13:54:01 EST (Sun, 10 Jan 2010)
@@ -13,6 +13,7 @@
 #define BOOST_GRAPH_SOURCE
 #include <boost/foreach.hpp>
 #include <boost/optional.hpp>
+#include <boost/throw_exception.hpp>
 #include <boost/graph/graphml.hpp>
 #include <boost/graph/dll_import_export.hpp>
 #include <boost/property_tree/ptree.hpp>
@@ -62,7 +63,7 @@
         else if (for_ == "port") kind = port_key;
         else if (for_ == "endpoint") kind = endpoint_key;
         else if (for_ == "all") kind = all_key;
- else throw parse_error("Attribute for is not valid: " + for_);
+ else {BOOST_THROW_EXCEPTION(parse_error("Attribute for is not valid: " + for_));}
         m_keys[id] = kind;
         m_key_name[id] = name;
         m_key_type[id] = type;
@@ -97,7 +98,11 @@
           std::string local_directed = edge.second.get(path("<xmlattr>/directed"), "");
           bool is_directed = (local_directed == "" ? default_directed : local_directed == "true");
           if (is_directed != m_g.is_directed()) {
- if (is_directed) throw directed_graph_error(); else throw undirected_graph_error();
+ if (is_directed) {
+ BOOST_THROW_EXCEPTION(directed_graph_error());
+ } else {
+ BOOST_THROW_EXCEPTION(undirected_graph_error());
+ }
           }
           size_t old_edges_size = m_edge.size();
           handle_edge(source, target);
@@ -164,8 +169,9 @@
         any edge;
         bool added;
         tie(edge, added) = m_g.do_add_edge(source, target);
- if (!added)
- throw bad_parallel_edge(u, v);
+ if (!added) {
+ BOOST_THROW_EXCEPTION(bad_parallel_edge(u, v));
+ }
 
         size_t e = m_edge.size();
         m_edge.push_back(edge);


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