Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-09 08:12:46

0001 //=======================================================================
0002 // Copyright 2002 Indiana University.
0003 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. (See
0006 // accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 //=======================================================================
0009 
0010 #ifndef BOOST_GRAPH_EXCEPTION_HPP
0011 #define BOOST_GRAPH_EXCEPTION_HPP
0012 
0013 #include <stdexcept>
0014 #include <string>
0015 
0016 #include <boost/config.hpp>
0017 
0018 namespace boost
0019 {
0020 
0021 struct BOOST_SYMBOL_VISIBLE bad_graph : public std::invalid_argument
0022 {
0023     bad_graph(const std::string& what_arg) : std::invalid_argument(what_arg) {}
0024 };
0025 
0026 struct BOOST_SYMBOL_VISIBLE not_a_dag : public bad_graph
0027 {
0028     not_a_dag() : bad_graph("The graph must be a DAG.") {}
0029 };
0030 
0031 struct BOOST_SYMBOL_VISIBLE negative_edge : public bad_graph
0032 {
0033     negative_edge()
0034     : bad_graph("The graph may not contain an edge with negative weight.")
0035     {
0036     }
0037 };
0038 
0039 struct BOOST_SYMBOL_VISIBLE negative_cycle : public bad_graph
0040 {
0041     negative_cycle() : bad_graph("The graph may not contain negative cycles.")
0042     {
0043     }
0044 };
0045 
0046 struct BOOST_SYMBOL_VISIBLE not_connected : public bad_graph
0047 {
0048     not_connected() : bad_graph("The graph must be connected.") {}
0049 };
0050 
0051 struct BOOST_SYMBOL_VISIBLE not_complete : public bad_graph
0052 {
0053     not_complete() : bad_graph("The graph must be complete.") {}
0054 };
0055 
0056 struct BOOST_SYMBOL_VISIBLE graph_exception : public std::exception
0057 {
0058     ~graph_exception() throw() BOOST_OVERRIDE {}
0059     const char* what() const throw() BOOST_OVERRIDE = 0;
0060 };
0061 
0062 struct BOOST_SYMBOL_VISIBLE bad_parallel_edge : public graph_exception
0063 {
0064     std::string from;
0065     std::string to;
0066     mutable std::string statement;
0067     bad_parallel_edge(const std::string& i, const std::string& j)
0068     : from(i), to(j)
0069     {
0070     }
0071 
0072     ~bad_parallel_edge() throw() BOOST_OVERRIDE {}
0073     const char* what() const throw() BOOST_OVERRIDE
0074     {
0075         if (statement.empty())
0076             statement = std::string("Failed to add parallel edge: (") + from
0077                 + "," + to + ")\n";
0078 
0079         return statement.c_str();
0080     }
0081 };
0082 
0083 struct BOOST_SYMBOL_VISIBLE directed_graph_error : public graph_exception
0084 {
0085     ~directed_graph_error() throw() BOOST_OVERRIDE {}
0086     const char* what() const throw() BOOST_OVERRIDE
0087     {
0088         return "read_graphviz: "
0089                "Tried to read a directed graph into an undirected graph.";
0090     }
0091 };
0092 
0093 struct BOOST_SYMBOL_VISIBLE undirected_graph_error : public graph_exception
0094 {
0095     ~undirected_graph_error() throw() BOOST_OVERRIDE {}
0096     const char* what() const throw() BOOST_OVERRIDE
0097     {
0098         return "read_graphviz: "
0099                "Tried to read an undirected graph into a directed graph.";
0100     }
0101 };
0102 
0103 } // namespace boost
0104 
0105 #endif // BOOST_GRAPH_EXCEPTION_HPP