Changeset 562 for code/branches/FICN/src
- Timestamp:
- Dec 17, 2007, 3:58:42 AM (17 years ago)
- Location:
- code/branches/FICN/src/orxonox/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/core/DebugLevel.cc
r561 r562 5 5 namespace orxonox 6 6 { 7 int DebugLevel::softDebugLevel_s; 8 9 // CreateFactory(DebugLevel); 7 DebugLevel* DebugLevel::pointer_s = 0; 8 bool DebugLevel::bCreatingDebugLevelObject_s = false; 10 9 11 10 DebugLevel::DebugLevel() 12 11 { 13 Register Object(DebugLevel);12 RegisterRootObject(DebugLevel); 14 13 SetConfigValue(softDebugLevel_s, 2); 15 14 } … … 17 16 int DebugLevel::getSoftDebugLevel() 18 17 { 19 return DebugLevel::softDebugLevel_s; 18 if (!pointer_s && !bCreatingDebugLevelObject_s) 19 { 20 bCreatingDebugLevelObject_s = true; 21 pointer_s = new DebugLevel; 22 bCreatingDebugLevelObject_s = false; 23 } 24 25 if (bCreatingDebugLevelObject_s) 26 return 4; 27 28 return pointer_s->softDebugLevel_s; 20 29 } 21 30 } -
code/branches/FICN/src/orxonox/core/DebugLevel.h
r561 r562 13 13 14 14 private: 15 static int softDebugLevel_s; 16 } myDebugObject; 15 int softDebugLevel_s; 16 static DebugLevel* pointer_s; 17 static bool bCreatingDebugLevelObject_s; 18 }; 17 19 } 18 20 -
code/branches/FICN/src/orxonox/core/Factory.cc
r553 r562 38 38 namespace orxonox 39 39 { 40 Factory* Factory::pointer_s = 0; 41 40 42 /** 41 43 @returns the Identifier with a given name. … … 103 105 Factory* Factory::getFactoryPointer() 104 106 { 105 static Factory theOneAndOnlyInstance = Factory(); 106 return &theOneAndOnlyInstance; 107 // static Factory theOneAndOnlyInstance = Factory(); 108 // return &theOneAndOnlyInstance; 109 if (!pointer_s) 110 pointer_s = new Factory(); 111 112 return pointer_s; 107 113 } 108 114 } -
code/branches/FICN/src/orxonox/core/Factory.h
r553 r562 37 37 static void changeNetworkID(Identifier* identifier, const unsigned int oldID, const unsigned int newID); 38 38 static void createClassHierarchy(); 39 40 39 static Factory* getFactoryPointer();// avoid overriding pointer_s in the static intialisation process 41 40 … … 44 43 Factory(const Factory& factory) {} // don't copy 45 44 ~Factory() {} // don't delete 46 static void checkPointer();47 45 46 static Factory* pointer_s; 48 47 std::map<std::string, Identifier*> identifierStringMap_; //!< The map, mapping the name with the Identifier 49 48 std::map<unsigned int, Identifier*> identifierNetworkIDMap_; //!< The map, mapping the network ID with the Identifier
Note: See TracChangeset
for help on using the changeset viewer.