Changeset 9924 in orxonox.OLD for branches/network/src/lib/lang/object_list.cc
- Timestamp:
- Nov 9, 2006, 7:16:15 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/lang/object_list.cc
r9910 r9924 25 25 * @return a new NewObejctList 26 26 */ 27 ObjectListBase::ObjectListBase(const std::string& className , int id)27 ObjectListBase::ObjectListBase(const std::string& className) 28 28 : _name(className) 29 29 { … … 36 36 assert(!ObjectListBase::classNameExists(className) && "Classes should only be included once, and no two classes should have the same name (key value)"); 37 37 38 if (id == -1) 39 { 40 id = ObjectListBase::_classesByID->size(); 41 // searching for a free ID 42 while (ObjectListBase::classIDExists(id)) ++id; 43 } 38 int id = ObjectListBase::_classesByID->size(); 39 // searching for a free ID 40 while (ObjectListBase::classIDExists(id)) ++id; 41 44 42 assert(!ObjectListBase::classIDExists(id) && "Classes should only be included once, and no two classes should have the same ID (key value)"); 45 43 … … 342 340 assert( false && "size of str2id does not match" ); 343 341 } 344 342 345 343 IDMap * map = new IDMap(); 346 344 347 345 std::map< std::string, int >::const_iterator it; 348 346 for ( it = str2id.begin(); it != str2id.end(); it++ ) … … 352 350 (*map)[ it->second ]->_id = it->second; 353 351 } 354 352 355 353 delete _classesByID; 356 354 _classesByID = map; … … 358 356 359 357 /** 360 * 361 * @return 358 * 359 * @return 362 360 */ 363 361 std::map< std::string, int > * ObjectListBase::createStrToId( ) 364 362 { 365 363 std::map< std::string, int > * res = new std::map< std::string, int >(); 366 364 367 365 NameMap::const_iterator it; 368 366 for ( it = _classesByName->begin(); it != _classesByName->end(); it++ ) … … 378 376 } 379 377 } 380 378 381 379 assert( id != -1 ); 382 380 (*res)[ it->first ] = id; 383 381 } 384 382 385 383 return res; 386 384 }
Note: See TracChangeset
for help on using the changeset viewer.