[906] | 1 | /* -*- C++ -*- |
---|
[907] | 2 | * src/hugo/debug.h - Part of HUGOlib, a generic C++ optimization library |
---|
[906] | 3 | * |
---|
| 4 | * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
---|
| 5 | * (Egervary Combinatorial Optimization Research Group, EGRES). |
---|
| 6 | * |
---|
| 7 | * Permission to use, modify and distribute this software is granted |
---|
| 8 | * provided that this copyright notice appears in all copies. For |
---|
| 9 | * precise terms see the accompanying LICENSE file. |
---|
| 10 | * |
---|
| 11 | * This software is provided "AS IS" with no warranty of any kind, |
---|
| 12 | * express or implied, and with no claim as to its suitability for any |
---|
| 13 | * purpose. |
---|
| 14 | * |
---|
| 15 | */ |
---|
[883] | 16 | |
---|
| 17 | #ifndef HUGO_DEBUG_H |
---|
| 18 | #define HUGO_DEBUG_H |
---|
| 19 | |
---|
| 20 | //! \file |
---|
| 21 | //! \brief Basic definitions for debug control. |
---|
| 22 | |
---|
| 23 | namespace hugo { |
---|
| 24 | |
---|
| 25 | //! Debug mode for testing/debugging |
---|
| 26 | |
---|
| 27 | //! Use this debug mode if you want exhaustive range and consistency checks. |
---|
| 28 | //! It also produces verbose debug messages. |
---|
| 29 | struct DebugOn { |
---|
| 30 | //! Example: check whether the edges added to a path are adjacent |
---|
| 31 | static const bool consistensy_check = true; |
---|
| 32 | |
---|
| 33 | static const bool range_check = true; |
---|
| 34 | |
---|
| 35 | //! Examples: initialize maps with some value; |
---|
| 36 | //! after deleting an item from UnionFindEnum set its value in the |
---|
| 37 | //! corresponding map to NULL... |
---|
| 38 | static const bool ensure_safe_state = true; |
---|
| 39 | |
---|
| 40 | static const int verbose = 5; |
---|
| 41 | }; |
---|
| 42 | |
---|
| 43 | //! Debug mode for turning off debug aids. |
---|
| 44 | |
---|
| 45 | //! This debud mode switches off all range and consistency checks, |
---|
| 46 | //! as well as the debug messages. |
---|
| 47 | //! |
---|
| 48 | struct DebugOff { |
---|
| 49 | static const bool consistensy_check = false; |
---|
| 50 | static const bool range_check = false; |
---|
| 51 | static const bool ensure_safe_state = false; |
---|
| 52 | static const int verbose = 0; |
---|
| 53 | }; |
---|
| 54 | |
---|
| 55 | #ifdef DEBUG |
---|
| 56 | //! The default debug mode. |
---|
| 57 | |
---|
| 58 | //! The default debug mode. |
---|
| 59 | //! |
---|
| 60 | typedef DebugOn DefaultDebugMode; |
---|
| 61 | #else |
---|
| 62 | //! The default debug mode. |
---|
| 63 | |
---|
| 64 | //! The default debug mode. |
---|
| 65 | //! |
---|
| 66 | typedef DebugOff DefaultDebugMode; |
---|
| 67 | #endif |
---|
| 68 | |
---|
| 69 | } |
---|
| 70 | #endif // HUGO_DEBUG_H |
---|