Changeset 9924 in orxonox.OLD
- Timestamp:
- Nov 9, 2006, 7:16:15 PM (18 years ago)
- Location:
- branches/network/src
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/Makefile.am
r9869 r9924 59 59 defs/globals.h \ 60 60 defs/compiler.h \ 61 defs/class_id_DEPRECATED.h \62 61 subprojects/benchmark.h 63 62 -
branches/network/src/lib/graphics/light.cc
r9869 r9924 26 26 #include "debug.h" 27 27 28 #include "class_id_DEPRECATED.h" 29 30 ObjectListDefinitionID(Light, CL_LIGHT); 28 ObjectListDefinition(Light); 31 29 CREATE_FACTORY(Light); 32 30 -
branches/network/src/lib/graphics/render2D/image_plane.cc
r9869 r9924 23 23 #include "p_node.h" 24 24 25 26 #include "class_id_DEPRECATED.h" 27 28 ObjectListDefinitionID(ImagePlane, CL_IMAGE_PLANE); 25 ObjectListDefinition(ImagePlane); 29 26 CREATE_FACTORY(ImagePlane); 30 27 -
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 } -
branches/network/src/lib/lang/object_list.h
r9909 r9924 32 32 * @brief Use this macro to easily define a Class to store its own ObjectListDefinition 33 33 * @param ClassName: the Name of the Class. 34 * @param ID: optional set a Fixed ID.35 */36 #define ObjectListDefinitionID(ClassName, ID) \37 ObjectList<ClassName> ClassName::_objectList(#ClassName, ID)38 39 /**40 * @brief Use this macro to easily define a Class to store its own ObjectListDefinition41 * @param ClassName: the Name of the Class.42 34 */ 43 35 #define ObjectListDefinition(ClassName) \ 44 ObjectList DefinitionID(ClassName, -1)36 ObjectList<ClassName> ClassName::_objectList(#ClassName) 45 37 46 38 class BaseObject; … … 109 101 110 102 protected: 111 ObjectListBase(const std::string& className , int id = -1);103 ObjectListBase(const std::string& className); 112 104 virtual ~ObjectListBase(); 113 105 … … 133 125 static NameMap* _classesByName; //!< A Map of all the classes in existance. 134 126 static std::list<std::string> _classNames; //!< A list of all the registered ClassNames. 135 127 136 128 public: 137 129 static void replaceIDMap( const std::map<std::string, int>& str2id ); … … 203 195 204 196 public: 205 ObjectList(const std::string& name , int id = -1);197 ObjectList(const std::string& name); 206 198 ~ObjectList(); 207 199 … … 260 252 */ 261 253 template <class T> 262 ObjectList<T>::ObjectList(const std::string& name , int id)263 : ObjectListBase(name , id)254 ObjectList<T>::ObjectList(const std::string& name) 255 : ObjectListBase(name) 264 256 {} 265 257
Note: See TracChangeset
for help on using the changeset viewer.