| 1 | // -*- C++ -*- // | 
|---|
| 2 |  | 
|---|
| 3 | #ifndef LEMON_DEBUG_H | 
|---|
| 4 | #define LEMON_DEBUG_H | 
|---|
| 5 |  | 
|---|
| 6 | //! \file | 
|---|
| 7 | //! \brief Basic definitions for debug control. | 
|---|
| 8 |  | 
|---|
| 9 | namespace lemon { | 
|---|
| 10 |  | 
|---|
| 11 | //! Debug mode for testing/debugging | 
|---|
| 12 |  | 
|---|
| 13 | //! Use this debug mode if you want exhaustive range and consistency checks. | 
|---|
| 14 | //! It also produces verbose debug messages. | 
|---|
| 15 | struct DebugOn { | 
|---|
| 16 | //! Example: check whether the edges added to a path are adjacent | 
|---|
| 17 | static const bool consistensy_check = true; | 
|---|
| 18 |  | 
|---|
| 19 | static const bool range_check = true; | 
|---|
| 20 |  | 
|---|
| 21 | //! Examples: initialize maps with some value; | 
|---|
| 22 | //! after deleting an item from UnionFindEnum set its value in the | 
|---|
| 23 | //! corresponding map to NULL... | 
|---|
| 24 | static const bool ensure_safe_state = true; | 
|---|
| 25 |  | 
|---|
| 26 | static const int verbose = 5; | 
|---|
| 27 | }; | 
|---|
| 28 |  | 
|---|
| 29 | //! Debug mode for turning off debug aids. | 
|---|
| 30 |  | 
|---|
| 31 | //! This debud mode switches off all range and consistency checks, | 
|---|
| 32 | //! as well as the debug messages. | 
|---|
| 33 | //! | 
|---|
| 34 | struct DebugOff { | 
|---|
| 35 | static const bool consistensy_check = false; | 
|---|
| 36 | static const bool range_check = false; | 
|---|
| 37 | static const bool ensure_safe_state = false; | 
|---|
| 38 | static const int verbose = 0; | 
|---|
| 39 | }; | 
|---|
| 40 |  | 
|---|
| 41 | #ifdef DEBUG | 
|---|
| 42 | //! The default debug mode. | 
|---|
| 43 |  | 
|---|
| 44 | //! The default debug mode. | 
|---|
| 45 | //! | 
|---|
| 46 | typedef DebugOn DefaultDebugMode; | 
|---|
| 47 | #else | 
|---|
| 48 | //! The default debug mode. | 
|---|
| 49 |  | 
|---|
| 50 | //! The default debug mode. | 
|---|
| 51 | //! | 
|---|
| 52 | typedef DebugOff DefaultDebugMode; | 
|---|
| 53 | #endif | 
|---|
| 54 |  | 
|---|
| 55 | } | 
|---|
| 56 | #endif // LEMON_DEBUG_H | 
|---|