Index: code/branches/console/src/libraries/util/Debug.h
===================================================================
--- code/branches/console/src/libraries/util/Debug.h	(revision 5983)
+++ code/branches/console/src/libraries/util/Debug.h	(revision 5991)
@@ -21,13 +21,15 @@
  *
  *   Author:
- *      Benjamin Grauer
+ *      Fabian 'x3n' Landau
+ *      Reto Grieder
  *   Co-authors:
- *      Fabian 'x3n' Landau
+ *      ...
  *
  */
 
 /**
-    @file
-    @brief Handles different output-levels of errors, warnings, infos and debug information.
+@file
+@brief
+    Handles different output-levels of errors, warnings, infos and debug information.
 
     The COUT(level) macro acts like std::cout, but the output is only performed if the given
@@ -35,7 +37,7 @@
 
     There are two used values in this file:
-     - The hard debug level is used during compiletime. It describes the highest allowed output level.
+     - The hard debug level is used during compile time. It describes the highest allowed output level.
      - The soft debug level is used during runtime and is the maximum of the three configurable
-       output-levels for console, logfile and ingame shell.
+       output-levels for console, log file and in game shell.
 
     The separation between the three devices is done by the OutputHandler.
@@ -50,210 +52,44 @@
      6: Crazy debug information
 
-    @example
+@example
     COUT(0) << "Very important output" << std::endl;
     COUT(1) << "Error: Something went wrong!" << std::endl;
     COUT(2) << "Warning: There might be a problem." << std::endl;
-    COUT(3) << "Info: It's monday" << std::endl;
+    COUT(3) << "Info: It's Monday" << std::endl;
     COUT(4) << "Debug: x is 1.23456" << std::endl;
- */
+*/
 
-#ifndef _Debug_H__
-#define _Debug_H__
+#ifndef _Util_Debug_H__
+#define _Util_Debug_H__
 
 #include "UtilPrereqs.h"
-
 #include "OutputHandler.h"
 
 namespace orxonox
 {
-    /**
-        @brief Returns the soft debug level, stored in the only existing instance of the OutputHandler class, configured in the config-file.
-        @return The soft debug level
-    */
-    inline int getSoftDebugLevel()
-    {
-        return OutputHandler::getSoftDebugLevel();
-    }
+    // Just for convenience
+    using std::endl;
 
-    using std::endl;
+    //! Adjust to discard certain output with level > hardDebugLevel at compile time
+    const int hardDebugLevel = OutputLevel::Verbose;
 }
 
-// DEFINE ERROR MODES
-#define ORX_NONE            0
-#define ORX_ERROR           1
-#define ORX_WARNING         2
-#define ORX_INFO            3
-#define ORX_DEBUG           4
-#define ORX_VERBOSE         5
-#define ORX_ULTRA           6
+/**
+@def COUT
+    Logs text output: use exactly like std::cout, but specify an output
+    level as argument. For example COUT(3) << "Some info" << std::endl;
+@note
+    The ? : operator requires both possible results to have the type of
+    the first. This is achieved by the int conversion operator dummy
+    in the OutputHandler.
+*/
+#define COUT(level)                                                    \
+    /*if*/ (level > orxonox::hardDebugLevel) ?                         \
+        0                                                              \
+    /*else*/ :                                                         \
+        /*if*/ (level > orxonox::OutputHandler::getSoftDebugLevel()) ? \
+            0                                                          \
+        /*else*/ :                                                     \
+            orxonox::OutputHandler::getOutStream(level)
 
-//definitions
-#define ORX_PRINT_DEBUG_OUTPUT 1
-#define ORX_HARD_DEBUG_LEVEL ORX_VERBOSE
-
-#define COUT_EXEC(x) orxonox::OutputHandler::getOutStream().setOutputLevel(x)
-
-////////////////////////////////////////////////////////
-///  COUT: just prints output as is with std::cout   ///
-////////////////////////////////////////////////////////
-#define COUTORX_NONE    COUT0
-#define COUTORX_ERROR   COUT1
-#define COUTORX_WARNING COUT2
-#define COUTORX_INFO    COUT3
-#define COUTORX_DEBUG   COUT4
-#define COUTORX_VERBOSE COUT5
-#define COUTORX_ULTRA   COUT6
-
-#ifndef COUT
- #if ORX_PRINT_DEBUG_OUTPUT
-  #define COUT(x) \
-   COUT ## x
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
-   #define COUT0 \
-   (orxonox::getSoftDebugLevel() < ORX_NONE) ? COUT_EXEC(0) : COUT_EXEC(0)
-  #else
-   #define COUT0 \
-    false ? COUT_EXEC(0) : COUT_EXEC(0)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
-   #define COUT1 \
-    (orxonox::getSoftDebugLevel() < ORX_ERROR) ? COUT_EXEC(1) : COUT_EXEC(1)
-  #else
-   #define COUT1 \
-    false ? COUT_EXEC(1) : COUT_EXEC(1)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
-   #define COUT2 \
-    (orxonox::getSoftDebugLevel() < ORX_WARNING) ? COUT_EXEC(2) : COUT_EXEC(2)
-  #else
-   #define COUT2 \
-    false ? COUT_EXEC(2) : COUT_EXEC(2)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
-   #define COUT3 \
-    (orxonox::getSoftDebugLevel() < ORX_INFO) ? COUT_EXEC(3) : COUT_EXEC(3)
-  #else
-   #define COUT3 \
-    false ? COUT_EXEC(3) : COUT_EXEC(3)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
-   #define COUT4 \
-    (orxonox::getSoftDebugLevel() < ORX_DEBUG) ? COUT_EXEC(4) : COUT_EXEC(4)
-  #else
-   #define COUT4 \
-    false ? COUT_EXEC(4) : COUT_EXEC(4)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
-   #define COUT5 \
-    (orxonox::getSoftDebugLevel() < ORX_VERBOSE) ? COUT_EXEC(5) : COUT_EXEC(5)
-  #else
-   #define COUT5 \
-    false ? COUT_EXEC(5) : COUT_EXEC(5)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
-   #define COUT6 \
-    (orxonox::getSoftDebugLevel() < ORX_ULTRA) ? COUT_EXEC(6) : COUT_EXEC(6)
-  #else
-   #define COUT6 \
-    false ? COUT_EXEC(6) : COUT_EXEC(6)
-  #endif
-
- #else /* if ORX_PRINT_DEBUG_OUTPUT */
-  #define COUT(x) \
-    false ? COUT_EXEC(6) : COUT_EXEC(6)
- #endif /* if ORX_PRINT_DEBUG_OUTPUT */
-
-#endif /* ifndef COUT */
-
-
-/////////////////////////////////////////////////////////////////////
-///  CCOUT: Prints output with std::cout and adds the classname   ///
-/////////////////////////////////////////////////////////////////////
-#define CCOUTORX_NONE    CCOUT0
-#define CCOUTORX_ERROR   CCOUT1
-#define CCOUTORX_WARNING CCOUT2
-#define CCOUTORX_INFO    CCOUT3
-#define CCOUTORX_DEBUG   CCOUT4
-#define CCOUTORX_VERBOSE CCOUT5
-#define CCOUTORX_ULTRA   CCOUT6
-
-#define CCOUT_EXEC(x) \
-  orxonox::OutputHandler::getOutStream().setOutputLevel(x) \
-  << this->getIdentifier()->getName() << ": "
-
-#ifndef CCOUT
- #if ORX_PRINT_DEBUG_OUTPUT
-  #define CCOUT(x) \
-   CCOUT ## x
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
-   #define CCOUT0 \
-    (orxonox::getSoftDebugLevel() < ORX_NONE) ? COUT_EXEC(0) : CCOUT_EXEC(0)
-  #else
-   #define CCOUT0 \
-    false ? COUT_EXEC(0) : CCOUT_EXEC(0)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
-   #define CCOUT1 \
-    (orxonox::getSoftDebugLevel() < ORX_ERROR) ? COUT_EXEC(1) : CCOUT_EXEC(1)
-  #else
-   #define CCOUT1 \
-    false ? COUT_EXEC(1) : CCOUT_EXEC(1)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
-   #define CCOUT2 \
-    (orxonox::getSoftDebugLevel() < ORX_WARNING) ? COUT_EXEC(2) : CCOUT_EXEC(2)
-  #else
-   #define CCOUT2 \
-    false ? COUT_EXEC(2) : CCOUT_EXEC(2)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
-   #define CCOUT3 \
-    (orxonox::getSoftDebugLevel() < ORX_INFO) ? COUT_EXEC(3) : CCOUT_EXEC(3)
-  #else
-   #define CCOUT3 \
-    false ? COUT_EXEC(3) : CCOUT_EXEC(3)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
-   #define CCOUT4 \
-    (orxonox::getSoftDebugLevel() < ORX_DEBUG) ? COUT_EXEC(4) : CCOUT_EXEC(4)
-  #else
-   #define CCOUT4 \
-    false ? COUT_EXEC(4) : CCOUT_EXEC(4)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
-   #define CCOUT5 \
-    (orxonox::getSoftDebugLevel() < ORX_VERBOSE) ? COUT_EXEC(5) : CCOUT_EXEC(5)
-  #else
-   #define CCOUT5 \
-    false ? COUT_EXEC(5) : CCOUT_EXEC(5)
-  #endif
-
-  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
-   #define CCOUT6 \
-    (orxonox::getSoftDebugLevel() < ORX_ULTRA) ? COUT_EXEC(6) : CCOUT_EXEC(6)
-  #else
-   #define CCOUT6 \
-    false ? COUT_EXEC(6) : CCOUT_EXEC(6)
-  #endif
-
- #else /* if ORX_PRINT_DEBUG_OUTPUT */
-  #define CCOUT(x) \
-   false ? CCOUT_EXEC(6) : CCOUT_EXEC(6)
- #endif /* if ORX_PRINT_DEBUG_OUTPUT */
-
-#endif /* ifndef CCOUT */
-
-#endif /* _Debug_H__ */
+#endif /* _Util_Debug_H__ */
Index: code/branches/console/src/libraries/util/OutputHandler.h
===================================================================
--- code/branches/console/src/libraries/util/OutputHandler.h	(revision 5983)
+++ code/branches/console/src/libraries/util/OutputHandler.h	(revision 5991)
@@ -48,4 +48,18 @@
 namespace orxonox
 {
+    namespace OutputLevel
+    {
+        enum Value
+        {
+            None    = 0,
+            Error   = 1,
+            Warning = 2,
+            Info    = 3,
+            Debug   = 4,
+            Verbose = 5,
+            Ultra   = 6,
+        };
+    }
+
     //! The OutputHandler acts like std::cout, but redirects output to the console, the logfile and the ingame shell.
     class _UtilExport OutputHandler
@@ -61,4 +75,6 @@
 
             static OutputHandler& getOutStream();
+            static inline OutputHandler& getOutStream(int level)
+                { return OutputHandler::getOutStream().setOutputLevel(level); }
 
             /** @brief Puts some text on the outstream. @param text The text */
@@ -142,4 +158,7 @@
             OutputHandler& operator<<(std::ios& (*manipulator)(std::ios&));
             OutputHandler& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
+
+            /** @brief Dummy operator required by Debug.h for the ternary operator */
+            inline operator int() { return 0; }
 
         private:
