Changeset 9677 in orxonox.OLD for trunk/src/lib/lang
- Timestamp:
- Aug 21, 2006, 11:40:41 PM (18 years ago)
- Location:
- trunk/src/lib/lang
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/lang/Makefile.am
r9674 r9677 29 29 test_object_list.cc 30 30 31 test_object_list_DEPENDENCIES = libORXlang.a 32 31 33 test_object_list_LDADD = \ 32 34 $(MAINSRCDIR)/util/libORXutils.a \ -
trunk/src/lib/lang/new_object_list.cc
r9676 r9677 23 23 : _name(className) 24 24 { 25 26 25 27 if (NewObjectListBase::_classesByID == NULL) 26 28 { … … 33 35 if (id != -1) 34 36 { 35 assert(!NewObjectListBase::classIDExists(id) && "Classes should only be included once, and no two classes should have the same ID (key value)");37 this->_id = id; 36 38 } 37 39 else 38 40 { 39 41 this->_id = NewObjectListBase::_classesByID->size(); 42 // searching for a free ID 43 while (NewObjectListBase::classIDExists(_id)) ++id; 40 44 } 45 assert(!NewObjectListBase::classIDExists(id) && "Classes should only be included once, and no two classes should have the same ID (key value)"); 46 47 /// Some Output, that will fall out later 48 std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl; 41 49 42 50 (*NewObjectListBase::_classesByID)[this->_id] = this; … … 52 60 NewObjectListBase::~NewObjectListBase() 53 61 { 62 assert (NewObjectListBase::_classesByName != NULL && NewObjectListBase::_classesByID != NULL); 63 64 std::cout << "Erasing: " << this->_name << " "<< this->_id << std::endl; 65 66 std::cout << "SIZE OF _classByID: " << NewObjectListBase::_classesByID->size() << std::endl; 67 std::cout << "SIZE OF _classByName: " << NewObjectListBase::_classesByName->size() << std::endl; 68 54 69 NewObjectListBase::_classesByName->erase(this->_name); 55 70 NewObjectListBase::_classesByID->erase(this->_id); … … 67 82 NewObjectListBase::classIDMap* NewObjectListBase::_classesByID = NULL; 68 83 NewObjectListBase::classNameMap* NewObjectListBase::_classesByName = NULL; 69 70 71 84 72 85 /** -
trunk/src/lib/lang/new_object_list.h
r9676 r9677 19 19 #define NewObjectListDefinition(ClassName) \ 20 20 NewObjectList<ClassName> ClassName::objectList(#ClassName) 21 22 #define NewObjectListDefinitionID(ClassName, ID) \ 23 NewObjectList<ClassName> ClassName::objectList(#ClassName, ID) 21 24 22 25 -
trunk/src/lib/lang/test_object_list.cc
r9675 r9677 43 43 //ObjectListDeclaration(Test); 44 44 }; 45 NewObjectListDefinition (Test);45 NewObjectListDefinitionID(Test, 0); 46 46 47 47 Test::Test() … … 70 70 NewObjectListDeclaration(Bone); 71 71 }; 72 NewObjectListDefinition (Bone);72 NewObjectListDefinitionID(Bone, -1); 73 73 74 74 int main()
Note: See TracChangeset
for help on using the changeset viewer.