00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef POSE_GRAPH_EXCEPTION_H
00032 #define POSE_GRAPH_EXCEPTION_H
00033
00034 #include <boost/format.hpp>
00035 #include <stdexcept>
00036 #include <string>
00037
00038 namespace pose_graph
00039 {
00040
00041 using boost::format;
00042 using std::string;
00043
00045 class PoseGraphException: public std::logic_error
00046 {
00047 public:
00048 PoseGraphException (const format& error_string) : std::logic_error(error_string.str()) {};
00049 PoseGraphException (const char* str) : std::logic_error(str) {};
00050 };
00051
00052
00054 struct UnknownNodeIdException: public PoseGraphException
00055 {
00056 UnknownNodeIdException (const unsigned id):
00057 PoseGraphException(format("Unknown node id %1%") % id), id(id) {}
00058 const unsigned id;
00059 };
00060
00062 struct UnknownEdgeIdException: public PoseGraphException
00063 {
00064 UnknownEdgeIdException (const unsigned id):
00065 PoseGraphException(format("Unknown edge id %1%") % id), id(id) {}
00066 const unsigned id;
00067 };
00068
00069
00071 struct DuplicateNodeIdException: public PoseGraphException
00072 {
00073 DuplicateNodeIdException (const unsigned id):
00074 PoseGraphException(format("Node %1% already exists") % id), id(id) {}
00075 const unsigned id;
00076 };
00077
00078
00080 struct DuplicateEdgeIdException: public PoseGraphException
00081 {
00082 DuplicateEdgeIdException (const unsigned id):
00083 PoseGraphException(format("Edge %1% already exists") % id), id(id) {}
00084 const unsigned id;
00085 };
00086
00088 struct NoOptimizedPoseException: public PoseGraphException
00089 {
00090 NoOptimizedPoseException (const unsigned id) : PoseGraphException (format ("No optimized pose for %1%") % id) {}
00091 };
00092
00094 struct UnknownDBTopicException: public PoseGraphException
00095 {
00096 UnknownDBTopicException (const string& topic) : PoseGraphException (format ("Topic %1% does not exist") % topic) {}
00097 };
00098
00100 struct DataNotFoundException: public PoseGraphException
00101 {
00102 DataNotFoundException (const unsigned n, const unsigned num_entries) :
00103 PoseGraphException (format ("Found %1% entries for %2% instead of 1") % num_entries % n) {}
00104 };
00105
00107 struct NodeDuplicateDataException: public PoseGraphException
00108 {
00109 NodeDuplicateDataException (const unsigned n) : PoseGraphException (format ("Node %1% already had stored data") % n) {}
00110 };
00111
00113 struct DisconnectedComponentException: public PoseGraphException
00114 {
00115 DisconnectedComponentException (const unsigned n, const unsigned n2) :
00116 PoseGraphException (format ("Nodes %1% and %2% are not in the same component, so can't jointly optimize")
00117 % n % n2), n(n), n2(n2)
00118 {}
00119
00120 const unsigned n, n2;
00121
00122 };
00123
00125 struct NoPathException: public PoseGraphException
00126 {
00127 NoPathException (const unsigned n, const unsigned n2) :
00128 PoseGraphException (format ("No path found from %1% to %2%") % n % n2) {}
00129 };
00130
00131 }
00132
00133 #endif // POSE_GRAPH_EXCEPTION_H