Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 686


Ignore:
Timestamp:
Dec 26, 2007, 7:22:06 PM (16 years ago)
Author:
rgrieder
Message:
  • replaced a little hack in DebugLevel through a tiny one.
Location:
code/branches/FICN
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/DebugLevel.cc

    r684 r686  
    3737namespace orxonox
    3838{
    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
    41 
    4239    /**
    4340        @brief Constructor: Registers the object and sets the debug level.
     
    4542    DebugLevel::DebugLevel()
    4643    {
     44        this->softDebugLevel_ = 4;   // accounts for the recursive call when creating the object
    4745        RegisterRootObject(DebugLevel);
    48         SetConfigValue(softDebugLevel_s, 2);
     46        SetConfigValue(softDebugLevel_, 2);
    4947    }
    5048
     
    5452    int DebugLevel::getSoftDebugLevel()
    5553    {
    56         if (!pointer_s && !bCreatingDebugLevelObject_s)
    57         {
    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.
    60             bCreatingDebugLevelObject_s = true;
    61             pointer_s = new DebugLevel;
    62             bCreatingDebugLevelObject_s = false;
    63         }
    64         else if (bCreatingDebugLevelObject_s)
    65             return 4;
    66 
    67         return pointer_s->softDebugLevel_s;
     54        static DebugLevel theOneAndOnlyInstance = DebugLevel();
     55        return theOneAndOnlyInstance.softDebugLevel_;
    6856    }
    6957}
  • code/branches/FICN/src/orxonox/core/DebugLevel.h

    r684 r686  
    5454            ~DebugLevel() {}                    // don't delete
    5555
    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)
     56            int softDebugLevel_;                //!< The output level
    5957    };
    6058}
  • code/branches/FICN/visual_studio/base_properties.vsprops

    r678 r686  
    1111                AdditionalIncludeDirectories="&quot;$(SolutionDir)\..\src&quot;;&quot;$(OGRE_HOME)\Dependencies\include&quot;;&quot;$(OGRE_HOME)\OgreMain\include&quot;;&quot;$(ORXONOX_HOME)\dependencies\include&quot;"
    1212                PreprocessorDefinitions="WIN32;__WIN32__;_WIN32;BOOST_ALL_DYN_LINK"
    13                 WarningLevel="3"
     13                WarningLevel="2"
    1414                Detect64BitPortabilityProblems="true"
    1515                DebugInformationFormat="3"
  • code/branches/FICN/visual_studio/core.vcproj

    r682 r686  
    191191                        </File>
    192192                        <File
     193                                RelativePath="..\src\orxonox\core\OutputHandler.cc"
     194                                >
     195                        </File>
     196                        <File
    193197                                RelativePath="..\src\orxonox\core\SignalHandler.cc"
    194198                                >
     
    261265                        </File>
    262266                        <File
     267                                RelativePath="..\src\orxonox\core\OutputHandler.h"
     268                                >
     269                        </File>
     270                        <File
    263271                                RelativePath="..\src\orxonox\core\SignalHandler.h"
    264272                                >
Note: See TracChangeset for help on using the changeset viewer.