# HG changeset patch # User alpar # Date 1095597935 0 # Node ID 4af619b64d98b3746685b35efe9949c24fdb23c7 # Parent 46974f296c4ab59289afcb64539e2e2da1b2bea9 Put away debug.h and error.h temporarily. diff -r 46974f296c4a -r 4af619b64d98 src/hugo/Makefile.am --- a/src/hugo/Makefile.am Sun Sep 19 12:26:42 2004 +0000 +++ b/src/hugo/Makefile.am Sun Sep 19 12:45:35 2004 +0000 @@ -6,7 +6,6 @@ default_map.h \ dijkstra.h \ dimacs.h \ - error.h \ extended_pair.h \ fib_heap.h \ full_graph.h \ diff -r 46974f296c4a -r 4af619b64d98 src/hugo/attic/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hugo/attic/debug.h Sun Sep 19 12:45:35 2004 +0000 @@ -0,0 +1,56 @@ +// -*- C++ -*- // + +#ifndef HUGO_DEBUG_H +#define HUGO_DEBUG_H + +//! \file +//! \brief Basic definitions for debug control. + +namespace hugo { + + //! Debug mode for testing/debugging + + //! Use this debug mode if you want exhaustive range and consistency checks. + //! It also produces verbose debug messages. + struct DebugOn { + //! Example: check whether the edges added to a path are adjacent + static const bool consistensy_check = true; + + static const bool range_check = true; + + //! Examples: initialize maps with some value; + //! after deleting an item from UnionFindEnum set its value in the + //! corresponding map to NULL... + static const bool ensure_safe_state = true; + + static const int verbose = 5; + }; + + //! Debug mode for turning off debug aids. + + //! This debud mode switches off all range and consistency checks, + //! as well as the debug messages. + //! + struct DebugOff { + static const bool consistensy_check = false; + static const bool range_check = false; + static const bool ensure_safe_state = false; + static const int verbose = 0; + }; + +#ifdef DEBUG + //! The default debug mode. + + //! The default debug mode. + //! + typedef DebugOn DefaultDebugMode; +#else + //! The default debug mode. + + //! The default debug mode. + //! + typedef DebugOff DefaultDebugMode; +#endif + +} +#endif // HUGO_DEBUG_H diff -r 46974f296c4a -r 4af619b64d98 src/hugo/attic/error.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hugo/attic/error.h Sun Sep 19 12:45:35 2004 +0000 @@ -0,0 +1,68 @@ +// -*- C++ -*- // + +#ifndef HUGO_ERROR_H +#define HUGO_ERROR_H + +//! \ingroup misc +//! \file +//! \brief Basic error handling (signaling) routines. + +#include +#include +#include + + +namespace hugo { + + /** + * \brief Generic exception class. + * + * \todo Do we need this? + * + * \todo Don't we need different kind of exceptions for different kind + * of errors? + * Shouldn't we use \ instead? + */ + class Exception : public std::exception { + protected: + std::ostringstream buf; + public: + Exception() {} + explicit Exception(const std::string &s) { buf << s; } + Exception(const Exception &e) : std::exception() { + buf << e.buf.str(); + } + virtual ~Exception() throw() {} + + virtual const char* what() const throw() { + return buf.str().c_str(); + } + + Exception& operator<<(std::string const& s) { buf << s; return *this; } + Exception& operator<<(char const *s) { buf << s; return *this; } + Exception& operator<<(int i) { buf << i; return *this; } + }; + + /** + * \brief Generic error signaling function. + * + * \todo Do we really need this? Is it helpful? + */ + inline void fault(const std::string &msg) { + throw Exception(msg); + } + + /** + * \brief Macro for mark not yet implemented features. + * + * \todo Is this the right place for this? It should be used only in + * modules under development. + */ + +# define FIXME(msg) \ + do { throw ::hugo::Exception() << "FIXME: " msg " (in: " \ + __FILE__ ", " << __LINE__ << ")"; \ + } while(false) + +} +#endif // HUGO_ERROR_H diff -r 46974f296c4a -r 4af619b64d98 src/hugo/debug.h --- a/src/hugo/debug.h Sun Sep 19 12:26:42 2004 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -// -*- C++ -*- // - -#ifndef HUGO_DEBUG_H -#define HUGO_DEBUG_H - -//! \file -//! \brief Basic definitions for debug control. - -namespace hugo { - - //! Debug mode for testing/debugging - - //! Use this debug mode if you want exhaustive range and consistency checks. - //! It also produces verbose debug messages. - struct DebugOn { - //! Example: check whether the edges added to a path are adjacent - static const bool consistensy_check = true; - - static const bool range_check = true; - - //! Examples: initialize maps with some value; - //! after deleting an item from UnionFindEnum set its value in the - //! corresponding map to NULL... - static const bool ensure_safe_state = true; - - static const int verbose = 5; - }; - - //! Debug mode for turning off debug aids. - - //! This debud mode switches off all range and consistency checks, - //! as well as the debug messages. - //! - struct DebugOff { - static const bool consistensy_check = false; - static const bool range_check = false; - static const bool ensure_safe_state = false; - static const int verbose = 0; - }; - -#ifdef DEBUG - //! The default debug mode. - - //! The default debug mode. - //! - typedef DebugOn DefaultDebugMode; -#else - //! The default debug mode. - - //! The default debug mode. - //! - typedef DebugOff DefaultDebugMode; -#endif - -} -#endif // HUGO_DEBUG_H diff -r 46974f296c4a -r 4af619b64d98 src/hugo/error.h --- a/src/hugo/error.h Sun Sep 19 12:26:42 2004 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -// -*- C++ -*- // - -#ifndef HUGO_ERROR_H -#define HUGO_ERROR_H - -//! \ingroup misc -//! \file -//! \brief Basic error handling (signaling) routines. - -#include -#include -#include - - -namespace hugo { - - /** - * \brief Generic exception class. - * - * \todo Do we need this? - * - * \todo Don't we need different kind of exceptions for different kind - * of errors? - * Shouldn't we use \ instead? - */ - class Exception : public std::exception { - protected: - std::ostringstream buf; - public: - Exception() {} - explicit Exception(const std::string &s) { buf << s; } - Exception(const Exception &e) : std::exception() { - buf << e.buf.str(); - } - virtual ~Exception() throw() {} - - virtual const char* what() const throw() { - return buf.str().c_str(); - } - - Exception& operator<<(std::string const& s) { buf << s; return *this; } - Exception& operator<<(char const *s) { buf << s; return *this; } - Exception& operator<<(int i) { buf << i; return *this; } - }; - - /** - * \brief Generic error signaling function. - * - * \todo Do we really need this? Is it helpful? - */ - inline void fault(const std::string &msg) { - throw Exception(msg); - } - - /** - * \brief Macro for mark not yet implemented features. - * - * \todo Is this the right place for this? It should be used only in - * modules under development. - */ - -# define FIXME(msg) \ - do { throw ::hugo::Exception() << "FIXME: " msg " (in: " \ - __FILE__ ", " << __LINE__ << ")"; \ - } while(false) - -} -#endif // HUGO_ERROR_H diff -r 46974f296c4a -r 4af619b64d98 src/test/Makefile.am --- a/src/test/Makefile.am Sun Sep 19 12:26:42 2004 +0000 +++ b/src/test/Makefile.am Sun Sep 19 12:45:35 2004 +0000 @@ -8,7 +8,6 @@ bfs_test \ dfs_test \ dijkstra_test \ - error_test \ graph_test \ graph_wrapper_test \ kruskal_test \ @@ -28,7 +27,6 @@ bfs_test_SOURCES = bfs_test.cc dfs_test_SOURCES = dfs_test.cc dijkstra_test_SOURCES = dijkstra_test.cc -error_test_SOURCES = error_test.cc graph_test_SOURCES = graph_test.cc graph_wrapper_test_SOURCES = graph_wrapper_test.cc kruskal_test_SOURCES = kruskal_test.cc