- Timestamp:
- Aug 21, 2006, 6:57:29 PM (18 years ago)
- Location:
- trunk/src/lib/lang
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/lang/Makefile.am
r9672 r9674 1 1 MAINSRCDIR=../.. 2 2 include $(MAINSRCDIR)/defs/include_paths.am 3 4 LIB_PREFIX=$(MAINSRCDIR)/lib 5 include $(MAINSRCDIR)/lib/BuildLibs.am 3 6 4 7 noinst_LIBRARIES = libORXlang.a … … 19 22 20 23 21 bin_PROGRAMS = test_object_list 24 25 ## THIS ALL IS JUST FOR TESTING!! 26 check_PROGRAMS = test_object_list 22 27 23 28 test_object_list_SOURCES = \ … … 25 30 26 31 test_object_list_LDADD = \ 32 $(MAINSRCDIR)/util/libORXutils.a \ 33 $(libORXlibs_a_LIBRARIES_) \ 34 $(MAINSRCDIR)/world_entities/libORXwe.a \ 35 $(libORXlibs_a_LIBRARIES_) \ 36 $(MAINSRCDIR)/util/libORXutils.a 37 38 #test_object_list_LDADD = \ 27 39 libORXlang.a -
trunk/src/lib/lang/new_class_id.cc
r9673 r9674 37 37 ClassList::iterator it; 38 38 for (it = this->_classes.begin(); it != this->_classes.end(); ++it) 39 { 39 40 (*it)._objectList->unregisterObject((*it)._iterator); 41 delete (*it)._iterator; 42 } 40 43 //_objectList->unregisterObject(this->_iterators); 41 44 } -
trunk/src/lib/lang/new_object_list.h
r9673 r9674 177 177 for (it = this->_objects.begin(); it != this->_objects.end(); ++it) 178 178 { 179 std::cout << (*it)-> name() << std::endl;179 std::cout << (*it)->getName() << std::endl; 180 180 } 181 181 } -
trunk/src/lib/lang/test_object_list.cc
r9673 r9674 3 3 #include <iostream> 4 4 5 class BaseObject 5 #include <base_object.h> 6 7 class NewBaseObject 6 8 { 7 9 public: 8 10 void setName(const std::string& name) { this->_objectName = name; }; 9 const std::string& name() const { return _objectName; };11 const std::string& getName() const { return _objectName; }; 10 12 bool operator==(const std::string& name) const { return _objectName == name; }; 11 13 12 NewObjectListDeclaration(BaseObject); 13 14 NewObjectListDeclaration(NewBaseObject); 14 15 15 16 protected: 16 BaseObject(const std::string& objectName = "") : _objectName(objectName) { this->registerObject(this, objectList); }; 17 NewBaseObject(const std::string& objectName = "") : _objectName(objectName) 18 { 19 this->registerObject(this, objectList); 20 }; 17 21 template<class T> 18 22 inline void registerObject(T* object, NewObjectList<T>& objectList) { _id.registerObject(object, objectList); }; … … 23 27 24 28 }; 25 NewObjectListDefinition( BaseObject);29 NewObjectListDefinition(NewBaseObject); 26 30 27 31 28 class Test : public BaseObject32 class Test : public NewBaseObject 29 33 { 30 34 public: … … 40 44 Test::Test() 41 45 { 46 // this->setClassID(CL_PARENT_NODE, "Test"); 42 47 this->registerObject(this, Test::objectList); 43 // std::cout << "Test()\n";48 // std::cout << "Test()\n"; 44 49 }; 45 50 Test::~Test() 46 51 { 47 // std::cout << "~Test()\n";52 // std::cout << "~Test()\n"; 48 53 } 49 54 … … 53 58 Bone() 54 59 { 55 this->registerObject(this, Bone::objectList);60 // this->registerObject(this, Bone::objectList); 56 61 //std::cout << "Bone()\n"; 57 62 }; 58 ~Bone() { 59 // std::cout << "~Bone()\n"; 63 ~Bone() 64 { 65 // std::cout << "~Bone()\n"; 60 66 }; 61 67 NewObjectListDeclaration(Bone); … … 65 71 int main() 66 72 { 73 for (unsigned int i = 0; i < 20; ++i) 74 { 75 std::cout<< i << std::endl; 76 Test* test = new Test[10000]; 77 delete[]test; 78 } 79 // char tmp[100]; 80 // for (unsigned int i = 0 ; i < 100; ++i) 81 // { 82 // sprintf(tmp, "Tmp_%d", i); 83 // test[i].setName(tmp); 84 // } 85 // Test::objectList.debug(); 86 // //test->setName("Test-object"); 87 // 88 // std::cout << "Here is debug of all BaseObject\n"; 89 // BaseObject::objectList.debug(); 90 // // delete bone; 91 // delete []test; 92 // std::cout << "Again\n"; 93 // BaseObject::objectList.debug(); 67 94 68 69 70 Test* test = new Test[1000000];71 //test->setName("Test-object");72 73 // Test::objectList.debug();74 /*75 Bone* bone = new Bone();76 bone->setName("Bone-object");*/77 78 //std::cout << "Here is debug of all Classes\n";79 //BaseObject::objectList.debug();80 // delete bone;81 delete []test;82 95 } 83 96
Note: See TracChangeset
for help on using the changeset viewer.