Changeset 9681 in orxonox.OLD for trunk/src/lib/lang
- Timestamp:
- Aug 22, 2006, 12:19:30 AM (18 years ago)
- Location:
- trunk/src/lib/lang
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/lang/new_class_id.cc
r9680 r9681 35 35 NewClassID::~NewClassID () 36 36 { 37 // assert(_objectList != NULL);38 37 ClassList::iterator it; 39 38 for (it = this->_classes.begin(); it != this->_classes.end(); ++it) … … 42 41 delete (*it)._iterator; 43 42 } 44 //_objectList->unregisterObject(this->_iterators);45 43 } 46 44 -
trunk/src/lib/lang/new_class_id.h
r9678 r9681 14 14 15 15 16 17 18 16 //! A class to dynamically allocate ClassID's and support a isA operator 19 17 class NewClassID … … 22 20 NewClassID(); 23 21 ~NewClassID(); 24 25 22 26 23 int leafClassID() const { return _classes.front()._objectList->id(); } -
trunk/src/lib/lang/new_object_list.cc
r9677 r9681 20 20 21 21 22 /** 23 * @brief Constructor, that creates an ObjectList while checking (development mode) for uniqueness of all Keys (names and ID's) 24 * @param className The Name of the Class to create an ObjectList for. 25 * @param id The ID if you like, or -1 otherwise. 26 * @return a new NewObejctList 27 */ 22 28 NewObjectListBase::NewObjectListBase(const std::string& className, int id) 23 29 : _name(className) 24 30 { 25 26 27 31 if (NewObjectListBase::_classesByID == NULL) 28 32 { … … 46 50 47 51 /// Some Output, that will fall out later 48 std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl;52 //std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl; 49 53 50 54 (*NewObjectListBase::_classesByID)[this->_id] = this; … … 61 65 { 62 66 assert (NewObjectListBase::_classesByName != NULL && NewObjectListBase::_classesByID != NULL); 63 67 /* 64 68 std::cout << "Erasing: " << this->_name << " "<< this->_id << std::endl; 65 66 69 std::cout << "SIZE OF _classByID: " << NewObjectListBase::_classesByID->size() << std::endl; 67 70 std::cout << "SIZE OF _classByName: " << NewObjectListBase::_classesByName->size() << std::endl; 68 71 */ 69 72 NewObjectListBase::_classesByName->erase(this->_name); 70 73 NewObjectListBase::_classesByID->erase(this->_id); -
trunk/src/lib/lang/new_object_list.h
r9677 r9681 12 12 #include <list> 13 13 #include <string> 14 #include <iostream> 14 15 15 16 … … 129 130 //// IMPLEMENTATION ///// 130 131 ///////////////////////// 132 /** 133 * @brief creates a new NewObjectList 134 * @param name The name of the Class. 135 * @param id The ID of the class if desired, or -1 if an id should be assigned automatically. 136 */ 131 137 template <class T> 132 138 NewObjectList<T>::NewObjectList(const std::string& name, int id) … … 134 140 {} 135 141 142 /** 143 * @brief deletes the NewObjectList. 144 */ 136 145 template <class T> 137 146 NewObjectList<T>::~NewObjectList() 138 147 { 139 // assert(_objects.empty()); 148 if (!_objects.empty()) 149 { 150 std::cout << "There are still Object in the ObjectList of " << this->name() << "(id:" << this->id() << ")\n"; 151 this->debug(); 152 } 140 153 } 141 154 … … 151 164 152 165 template <class T> 153 166 NewObjectListBase::IteratorBase* NewObjectList<T>::registerObject(T* object) 154 167 { 155 168 this->_objects.push_front(object); … … 164 177 } 165 178 166 #include <iostream>167 179 168 180 template <class T> -
trunk/src/lib/lang/test_object_list.cc
r9680 r9681 64 64 { 65 65 this->registerObject(this, Bone::objectList); 66 this->_id.listInheritance();66 //this->_id.listInheritance(); 67 67 std::cout << "LeafID:" << this->_id.leafClassID() << std::endl; 68 68 … … 79 79 int main() 80 80 { 81 for (unsigned int i = 0; i < 20; ++i) 81 #define ITERATIONS 20 82 #define COUNT 100 83 for (unsigned int i = 0; i < ITERATIONS; ++i) 82 84 { 83 85 std::cout<< i << std::endl ; 84 Bone* test = new Bone[ 10000];85 //delete[]test;86 Bone* test = new Bone[COUNT]; 87 delete[]test; 86 88 } 87 89 // char tmp[100];
Note: See TracChangeset
for help on using the changeset viewer.