Changeset 453
- Timestamp:
- Dec 10, 2007, 5:07:46 PM (17 years ago)
- Location:
- code/branches/objecthierarchy/src
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/CMakeLists.txt
r443 r453 3 3 # create a few variables to simplify life 4 4 SET(SRC_FILES orxonox/orxonox.cc loader/LevelLoader.cc xml/xmlParser.cc orxonox/core/IdentifierList.cc orxonox/core/Identifier.cc orxonox/core/MetaObjectList.cc orxonox/core/Factory.cc orxonox/core/OrxonoxClass.cc orxonox/core/ConfigValueContainer.cc orxonox/objects/BaseObject.cc orxonox/objects/test1.cc orxonox/objects/test2.cc orxonox/objects/test3.cc) 5 SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h orxonox/core/CoreIncludes.h orxonox/core/ Identifier.h orxonox/core/Factory.h orxonox/core/ClassFactory.h orxonox/core/IdentifierList.h orxonox/core/ObjectList.h orxonox/core/MetaObjectList.h orxonox/core/Iterator.h orxonox/core/OrxonoxClass.h orxonox/core/ConfigValueContainer.h orxonox/objects/BaseObject.h orxonox/objects/Test.h orxonox/objects/test1.h orxonox/objects/test2.h orxonox/objects/test3.h orxonox/objects/Tickable.h orxonox/objects/Timer.h)5 SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h orxonox/core/CoreIncludes.h orxonox/core/Debug.h orxonox/core/Identifier.h orxonox/core/Factory.h orxonox/core/ClassFactory.h orxonox/core/IdentifierList.h orxonox/core/ObjectList.h orxonox/core/MetaObjectList.h orxonox/core/Iterator.h orxonox/core/OrxonoxClass.h orxonox/core/ConfigValueContainer.h orxonox/objects/BaseObject.h orxonox/objects/Test.h orxonox/objects/test1.h orxonox/objects/test2.h orxonox/objects/test3.h orxonox/objects/Tickable.h orxonox/objects/Timer.h) 6 6 7 7 #Creates an executable -
code/branches/objecthierarchy/src/orxonox/core/ClassFactory.h
r452 r453 10 10 11 11 #include "Identifier.h" 12 #include "Debug.h" 12 13 13 14 namespace orxonox … … 44 45 // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards. 45 46 ClassIdentifier<T>::getIdentifier()->startCreatingHierarchy(); 46 #if HIERARCHY_VERBOSE 47 std::cout << "*** Create Factory -> Create Class\n"; 48 #endif 47 COUT(4) << "*** Create Factory -> Create Class\n"; 49 48 BaseObject* temp = ClassIdentifier<T>::getIdentifier()->fabricate(); 50 49 delete temp; -
code/branches/objecthierarchy/src/orxonox/core/CoreIncludes.h
r450 r453 17 17 #include "OrxonoxClass.h" 18 18 #include "ConfigValueContainer.h" 19 #include "Debug.h" 19 20 20 21 #include "OgreVector2.h" … … 56 57 @param ClassName The name of the class 57 58 */ 58 #if HIERARCHY_VERBOSE59 59 #define RegisterObject(ClassName) \ 60 std::cout<< "*** Register Object: " << #ClassName << "\n"; \60 COUT(4) << "*** Register Object: " << #ClassName << "\n"; \ 61 61 InternRegisterObject(ClassName, false) 62 #else63 #define RegisterObject(ClassName) \64 InternRegisterObject(ClassName, false)65 #endif66 62 67 63 /** … … 69 65 @param ClassName The name of the class 70 66 */ 71 #if HIERARCHY_VERBOSE72 67 #define RegisterRootObject(ClassName) \ 73 std::cout<< "*** Register Root-Object: " << #ClassName << "\n"; \68 COUT(4) << "*** Register Root-Object: " << #ClassName << "\n"; \ 74 69 InternRegisterRootObject(ClassName) 75 #else76 #define RegisterRootObject(ClassName) \77 InternRegisterRootObject(ClassName)78 #endif79 70 80 71 /** -
code/branches/objecthierarchy/src/orxonox/core/Identifier.cc
r447 r453 41 41 void Identifier::initialize(const IdentifierList* parents) 42 42 { 43 #if HIERARCHY_VERBOSE 44 std::cout << "*** Initialize " << this->name_ << "-Singleton.\n"; 45 #endif 43 COUT(4) << "*** Initialize " << this->name_ << "-Singleton.\n"; 46 44 this->bCreatedOneObject_ = true; 47 45 … … 72 70 { 73 71 // Abstract classes don't have a factory and therefore can't create new objects 74 std::cout<< "Error: Cannot create an object of type '" << this->name_ << "'. Class is abstract.\n";75 std::cout<< "Aborting...";72 COUT(1) << "Error: Cannot create an object of type '" << this->name_ << "'. Class is abstract.\n"; 73 COUT(1) << "Aborting..."; 76 74 abort(); 77 75 } -
code/branches/objecthierarchy/src/orxonox/core/Identifier.h
r452 r453 32 32 #include "Factory.h" 33 33 #include "ConfigValueContainer.h" 34 35 #define HIERARCHY_VERBOSE 0 36 34 #include "Debug.h" 37 35 38 36 namespace orxonox … … 118 116 { 119 117 hierarchyCreatingCounter_s++; 120 #if HIERARCHY_VERBOSE 121 std::cout << "*** Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n"; 122 #endif 118 COUT(4) << "*** Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n"; 123 119 } 124 120 … … 129 125 { 130 126 hierarchyCreatingCounter_s--; 131 #if HIERARCHY_VERBOSE 132 std::cout << "*** Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n"; 133 #endif 127 COUT(4) << "*** Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << "\n"; 134 128 } 135 129 … … 206 200 ClassIdentifier<T>* ClassIdentifier<T>::registerClass(const IdentifierList* parents, const std::string& name, bool bRootClass) 207 201 { 208 #if HIERARCHY_VERBOSE 209 std::cout << "*** Register Class in " << name << "-Singleton.\n"; 210 #endif 202 COUT(4) << "*** Register Class in " << name << "-Singleton.\n"; 211 203 212 204 // It's a singleton, so maybe we have to create it first 213 205 if (!pointer_s) 214 206 { 215 #if HIERARCHY_VERBOSE 216 std::cout << "*** Register Class in " << name << "-Singleton -> Create Singleton.\n"; 217 #endif 207 COUT(4) << "*** Register Class in " << name << "-Singleton -> Create Singleton.\n"; 218 208 pointer_s = new ClassIdentifier(); 219 209 } … … 224 214 // If no: We have to store the informations and initialize the Identifier 225 215 226 #if HIERARCHY_VERBOSE 227 std::cout << "*** Register Class in " << name << "-Singleton -> Initialize Singleton.\n"; 228 #endif 216 COUT(4) << "*** Register Class in " << name << "-Singleton -> Initialize Singleton.\n"; 229 217 pointer_s->name_ = name; 230 218 Factory::add(name, pointer_s); // Add the Identifier to the Factory … … 247 235 if (!pointer_s) 248 236 { 249 #if HIERARCHY_VERBOSE 250 std::cout << "*** Create Singleton.\n"; 251 #endif 237 COUT(4) << "*** Create Singleton.\n"; 252 238 pointer_s = new ClassIdentifier(); 253 239 } … … 263 249 void ClassIdentifier<T>::addObject(T* object) 264 250 { 265 #if HIERARCHY_VERBOSE 266 std::cout << "*** Added object to " << ClassIdentifier<T>::getIdentifier()->getName() << "-list.\n"; 267 #endif 251 COUT(4) << "*** Added object to " << ClassIdentifier<T>::getIdentifier()->getName() << "-list.\n"; 268 252 object->getMetaList().add(ClassIdentifier<T>::getIdentifier()->objects_, ClassIdentifier<T>::getIdentifier()->objects_->add(object)); 269 253 } … … 300 284 if (!identifier->isA(ClassIdentifier<T>::getIdentifier())) 301 285 { 302 std::cout<< "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!\n";303 std::cout<< "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden.\n";304 std::cout<< "Aborting...\n";286 COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!\n"; 287 COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden.\n"; 288 COUT(1) << "Aborting...\n"; 305 289 abort(); 306 290 } … … 346 330 if (this->identifier_) 347 331 { 348 std::cout<< "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!\n";349 std::cout<< "Error: Couldn't fabricate a new Object.\n";350 std::cout<< "Aborting...\n";332 COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!\n"; 333 COUT(1) << "Error: Couldn't fabricate a new Object.\n"; 334 COUT(1) << "Aborting...\n"; 351 335 } 352 336 else 353 337 { 354 std::cout<< "Error: Couldn't fabricate a new Object - Identifier is undefined.\n";355 std::cout<< "Aborting...\n";338 COUT(1) << "Error: Couldn't fabricate a new Object - Identifier is undefined.\n"; 339 COUT(1) << "Aborting...\n"; 356 340 } 357 341 -
code/branches/objecthierarchy/src/orxonox/core/Iterator.h
r452 r453 18 18 #ifndef _Iterator_H__ 19 19 #define _Iterator_H__ 20 21 #include "Debug.h" 20 22 21 23 namespace orxonox … … 100 102 // Comparing with anything except zero makes no sense 101 103 if (compare != 0) 102 std::cout<< "Warning: Comparing the " << ClassIdentifier<T>::getIdentifier()->getName() << "-List-Iterator with " << compare << " has no effect. Only comparison with 0 works.\n";104 COUT(2) << "Warning: Comparing the " << ClassIdentifier<T>::getIdentifier()->getName() << "-List-Iterator with " << compare << " has no effect. Only comparison with 0 works.\n"; 103 105 104 106 return (this->element_ != 0); -
code/branches/objecthierarchy/src/orxonox/core/MetaObjectList.h
r447 r453 13 13 #include "ObjectList.h" 14 14 #include "Identifier.h" 15 #include "Debug.h" 15 16 16 17 namespace orxonox … … 69 70 70 71 71 #if HIERARCHY_VERBOSE 72 std::cout << "*** Removing Object from " << ClassIdentifier<T>::getIdentifier()->getName() << "-list.\n"; 73 #endif 72 COUT(4) << "*** Removing Object from " << ClassIdentifier<T>::getIdentifier()->getName() << "-list.\n"; 74 73 delete this->element_; 75 74 }
Note: See TracChangeset
for help on using the changeset viewer.