Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 684 for code/branches/FICN


Ignore:
Timestamp:
Dec 26, 2007, 2:19:53 PM (17 years ago)
Author:
landauf
Message:
  • added new class: the OutputHandler replaces std::cout in Debug.h and redirects the output not only to the console, but also into orxonox.log (this works, of course, only for output using COUT(level) from Debug.h)
  • commented DebugLevel
Location:
code/branches/FICN/src/orxonox/core
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/CMakeLists.txt

    r560 r684  
    1212  ArgReader.cc
    1313  DebugLevel.cc
     14  OutputHandler.cc
    1415)
    1516
    1617IF(WIN32)
    17   ADD_LIBRARY(core ${CORE_SRC_FILES})
     18  ADD_LIBRARY(core SHARED ${CORE_SRC_FILES})
    1819ELSE(WIN32)
    1920  ADD_LIBRARY(core SHARED ${CORE_SRC_FILES})
  • code/branches/FICN/src/orxonox/core/CorePrereqs.h

    r682 r684  
    6161class SignalHandler;
    6262
    63 namespace orxonox {
     63namespace orxonox
     64{
    6465  class ArgReader;
    6566  class BaseFactory;
     
    8687  class ObjectListElement;
    8788  class OrxonoxClass;
     89  class OutputHandler;
    8890  template <class T>
    8991  class SubclassIdentifier;
  • code/branches/FICN/src/orxonox/core/Debug.h

    r682 r684  
    3737
    3838#include <stdio.h>
    39 #include <iostream>
     39#include "OutputHandler.h"
    4040
    4141#include "CorePrereqs.h"
     
    6868
    6969#define PRINT_EXEC  printf
    70 #define COUT_EXEC   std::cout
     70//#define COUT_EXEC   std::cout
     71#define COUT_EXEC   orxonox::OutputHandler::getOutStream()
    7172
    7273#ifndef PRINTF
  • code/branches/FICN/src/orxonox/core/DebugLevel.cc

    r682 r684  
    2626 */
    2727
     28/*!
     29    @file DebugLevel.cc
     30    @brief Implementation of the DebugLevel class.
     31*/
     32
    2833#include "CoreIncludes.h"
    2934#include "Debug.h"
     
    3237namespace orxonox
    3338{
    34     DebugLevel* DebugLevel::pointer_s = 0;
    35     bool DebugLevel::bCreatingDebugLevelObject_s = false;
     39    DebugLevel* DebugLevel::pointer_s = 0;                // Set the static member variable pointer_s to zero
     40    bool DebugLevel::bCreatingDebugLevelObject_s = false; // Set the static member variable bCreatingDebugLevelObject_s to false
    3641
     42    /**
     43        @brief Constructor: Registers the object and sets the debug level.
     44    */
    3745    DebugLevel::DebugLevel()
    3846    {
     
    4149    }
    4250
     51    /**
     52        @returns a pointer to the only existing instance of this class.
     53    */
    4354    int DebugLevel::getSoftDebugLevel()
    4455    {
    4556        if (!pointer_s && !bCreatingDebugLevelObject_s)
    4657        {
     58            // We need the bCreatingDebugLevelObject_s variable to avoid an infinite recursion:
     59            // Creating the object produces debug output and debug output needs the object.
    4760            bCreatingDebugLevelObject_s = true;
    4861            pointer_s = new DebugLevel;
    4962            bCreatingDebugLevelObject_s = false;
    5063        }
    51 
    52         if (bCreatingDebugLevelObject_s)
     64        else if (bCreatingDebugLevelObject_s)
    5365            return 4;
    5466
     
    5769}
    5870
     71/**
     72    @returns the soft debug level, stored in the only existing instance of the DebugLevel class, configured in the config-file.
     73*/
    5974int getSoftDebugLevel()
    6075{
  • code/branches/FICN/src/orxonox/core/DebugLevel.h

    r682 r684  
    2626 */
    2727
     28/*!
     29    @file DebugLevel.h
     30    @brief Definition of the DebugLevel class.
     31
     32    The DebugLevel class is a singleton, only used to configure the amount of debug
     33    output (see Debug.h) into the console and the log-file (see OutputHandler.h).
     34*/
     35
    2836#ifndef _DebugLevel_H__
    2937#define _DebugLevel_H__
     
    3543namespace orxonox
    3644{
     45    //! The DebugLevel class is a singleton, only used to configure the amount of debug output.
    3746    class _CoreExport DebugLevel : public OrxonoxClass
    3847    {
    3948        public:
    40             DebugLevel();
    4149            static int getSoftDebugLevel();
    4250
    4351        private:
    44             int softDebugLevel_s;
    45             static DebugLevel* pointer_s;
    46             static bool bCreatingDebugLevelObject_s;
     52            DebugLevel();                       // don't create
     53            DebugLevel(const DebugLevel& dl) {} // don't copy
     54            ~DebugLevel() {}                    // don't delete
     55
     56            int softDebugLevel_s;                       //!< The output level
     57            static DebugLevel* pointer_s;               //!< A pointer to the only existing instance of this class
     58            static bool bCreatingDebugLevelObject_s;    //!< True if the only instance is being created (this is needed to avoid recurstion - creating the object produces debug output, debug output needs the object)
    4759    };
    4860}
  • code/branches/FICN/src/orxonox/core/Error.h

    r682 r684  
    2020 *
    2121 *   Author:
    22  *      Fabian 'x3n' Landau
     22 *      Nicolas Perrenoud
    2323 *   Co-authors:
    2424 *      ...
  • code/branches/FICN/src/orxonox/core/SignalHandler.h

    r682 r684  
    8686};
    8787
    88 #else /* if defined __WIN32__ */
     88#else /* #ifndef __WIN32__ */
    8989
    9090class _CoreExport SignalHandler
     
    9999    static SignalHandler * singletonRef;
    100100};
    101 #endif
     101#endif /* #ifndef __WIN32__ */
    102102
    103103#endif /* _SignalHandler_H__ */
Note: See TracChangeset for help on using the changeset viewer.