Changeset 686 for code/branches/FICN/src/orxonox/core/DebugLevel.cc
- Timestamp:
- Dec 26, 2007, 7:22:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/core/DebugLevel.cc
r684 r686 37 37 namespace orxonox 38 38 { 39 DebugLevel* DebugLevel::pointer_s = 0; // Set the static member variable pointer_s to zero40 bool DebugLevel::bCreatingDebugLevelObject_s = false; // Set the static member variable bCreatingDebugLevelObject_s to false41 42 39 /** 43 40 @brief Constructor: Registers the object and sets the debug level. … … 45 42 DebugLevel::DebugLevel() 46 43 { 44 this->softDebugLevel_ = 4; // accounts for the recursive call when creating the object 47 45 RegisterRootObject(DebugLevel); 48 SetConfigValue(softDebugLevel_ s, 2);46 SetConfigValue(softDebugLevel_, 2); 49 47 } 50 48 … … 54 52 int DebugLevel::getSoftDebugLevel() 55 53 { 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_; 68 56 } 69 57 }
Note: See TracChangeset
for help on using the changeset viewer.