Changeset 9807 in orxonox.OLD for branches/new_class_id/src/lib
- Timestamp:
- Sep 24, 2006, 11:26:48 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/lang/base_object.cc
r9806 r9807 32 32 this->objectName = objectName; 33 33 this->xmlElem = NULL; 34 this->registerObject(this, BaseObject::_objectList); 34 35 } 35 36 … … 40 41 { 41 42 /// Remove from the ObjectLists 42 ClassList::iterator it; 43 ClassEntries::iterator it; 44 printf("Deleting Object of type %s::%s\n", this->getClassCName(), getCName()); 43 45 for (it = this->_classes.begin(); it != this->_classes.end(); ++it) 44 46 { 47 assert((*it)._objectList->checkIteratorInList((*it)._iterator) || (*it)._objectList->checkObjectInList(this)); 45 48 (*it)._objectList->unregisterObject((*it)._iterator); 46 49 delete (*it)._iterator; … … 87 90 bool BaseObject::isA(const ObjectListBase& objectList) const 88 91 { 89 Class List::const_iterator it;92 ClassEntries::const_iterator it; 90 93 for (it = this->_classes.begin(); it != this->_classes.end(); ++it) 91 94 if ((*it)._objectList == &objectList) … … 102 105 bool BaseObject::isA(const ClassID& classID) const 103 106 { 104 Class List::const_iterator it;107 ClassEntries::const_iterator it; 105 108 for (it = this->_classes.begin(); it != this->_classes.end(); ++it) 106 109 if (*(*it)._objectList == classID) … … 116 119 bool BaseObject::isA(int classID) const 117 120 { 118 Class List::const_iterator it;121 ClassEntries::const_iterator it; 119 122 for (it = this->_classes.begin(); it != this->_classes.end(); ++it) 120 123 if (*(*it)._objectList == classID) 124 121 125 return true; 122 126 return false; … … 130 134 bool BaseObject::isA(const std::string& className) const 131 135 { 132 Class List::const_iterator it;136 ClassEntries::const_iterator it; 133 137 for (it = this->_classes.begin(); it != this->_classes.end(); ++it) 134 138 if (*(*it)._objectList == className) … … 146 150 { 147 151 PRINT(0)("Listing inheritance diagram for %s::%s: ", getClassCName(), getCName()); 148 Class List::const_iterator it;152 ClassEntries::const_iterator it; 149 153 for (it = this->_classes.begin(); it != this->_classes.end(); ++it) 150 154 PRINT(0)(" -> %s(id:%d)", (*it)._objectList->name().c_str(), (*it)._objectList->id()); -
branches/new_class_id/src/lib/lang/base_object.h
r9724 r9807 84 84 /** Simple Constuctor @param objectList the ObjectList, @param iterator the (intrusive) Iterator inside of the ObjectList */ 85 85 inline ClassEntry (ObjectListBase* objectList, ObjectListBase::IteratorBase* iterator) : _objectList(objectList), _iterator(iterator) {} 86 ObjectListBase* _objectList; //!< A ObjectList this Object is part of86 ObjectListBase* _objectList; //!< An ObjectList this Object is part of 87 87 ObjectListBase::IteratorBase* _iterator; //!< An iterator pointing to the position of the Object inside of the List. 88 88 }; 89 typedef std::list<ClassEntry> ClassList; //!< Type definition for the List.89 typedef std::list<ClassEntry> ClassEntries; //!< Type definition for the List. 90 90 91 91 std::string className; //!< the name of the class 92 Class List_classes; //!< All Classes this object is part of.92 ClassEntries _classes; //!< All Classes this object is part of. 93 93 }; 94 94 -
branches/new_class_id/src/lib/lang/object_list.h
r9757 r9807 104 104 //! Only used to unsubscribe a BaseObject. (just try to make a valid iterator, stupid :)) 105 105 virtual void unregisterObject(IteratorBase* _iterators) = 0; 106 //! Only for debug purposes 107 virtual bool checkIteratorInList(IteratorBase* _iterator) const = 0; 108 virtual bool checkObjectInList(BaseObject* obj) const = 0; 106 109 107 110 protected: … … 226 229 ObjectListBase::IteratorBase* registerObject(T* object); 227 230 virtual void unregisterObject(IteratorBase* iterator); 228 231 bool checkIteratorInList(IteratorBase* iterator) const; 232 bool checkObjectInList(BaseObject* obj) const; 229 233 protected: 230 234 virtual void getBaseObjectList(ObjectListBase::base_list* list) const; … … 345 349 } 346 350 351 template <class T> 352 bool ObjectList<T>::checkIteratorInList(IteratorBase* iterator) const 353 { 354 const_iterator it; 355 for (it = this->_objects.begin(); it != this->_objects.end(); ++it) 356 if (static_cast<Iterator*>(iterator)->it() == it) 357 return true; 358 printf("ObjectList:: checkIteratorInList:: ITERATOR NOT IN THE LIST '%s' (UN-SYNC SHOULD NOT HAPPEN!!)\n", this->name().c_str()); 359 return false; 360 } 361 362 template <class T> 363 bool ObjectList<T>::checkObjectInList(BaseObject* obj) const 364 { 365 T* object = dynamic_cast<T*>(obj); 366 if (object != NULL) 367 { 368 printf("EXTREME BUG: Object does not exist anymore!! (or a bug in ObjectList)\n"); 369 return false;; 370 } 371 372 const_iterator it; 373 for (it = this->_objects.begin(); it != this->_objects.end(); ++it) 374 { 375 if (*it == object) 376 return true; 377 } 378 printf("ObjectList:: checkObjectInList:: OBJECT NOT IN THE LIST '%s' (UN-SYNC SHOULD NOT HAPPEN!!)\n", this->name().c_str()); 379 return false; 380 } 381 382 347 383 #endif /* _OBJECT_LIST_H */ -
branches/new_class_id/src/lib/sound/sound_buffer.cc
r9806 r9807 28 28 : data(new SoundBufferData) 29 29 { 30 this->registerObject(this, SoundBuffer::_objectList);30 // this->registerObject(this, SoundBuffer::_objectList); 31 31 } 32 32 /** … … 37 37 : data(new SoundBufferData) 38 38 { 39 this->registerObject(this, SoundBuffer::_objectList);39 // this->registerObject(this, SoundBuffer::_objectList); 40 40 this->load(fileName); 41 41 } … … 44 44 : data(buffer.data) 45 45 { 46 this->registerObject(this, SoundBuffer::_objectList);46 // this->registerObject(this, SoundBuffer::_objectList); 47 47 } 48 48 … … 50 50 : data(dataPointer) 51 51 { 52 this->registerObject(this, SoundBuffer::_objectList);52 // this->registerObject(this, SoundBuffer::_objectList); 53 53 }; 54 54 55 55 SoundBuffer::~SoundBuffer() 56 56 { 57 printf("Deleting Object of type SoundBuffer\n");58 57 } 59 58
Note: See TracChangeset
for help on using the changeset viewer.