| 1 | = ObjectListBase = |
| 2 | [[TracNav(TracNav/TOC_Development)]] |
| 3 | |
| 4 | == Information == |
| 5 | The !ObjectListBase contains all existing objects of a given class. An object is listed in the lists of its class and all parent classes. A newly created object gets added to the lists by calling RegisterObject (see [wiki:CoreIncludes]) in the constructor. |
| 6 | |
| 7 | The list of a given class is located in the [wiki:Identifier] of the class. |
| 8 | |
| 9 | !ObjectListBase threats all objects as [wiki:OrxonoxClass OrxonoxClasses] and doesn't care about the real class. See [wiki:ObjectList] for a class-specific wrapper to !ObjectListBase. |
| 10 | |
| 11 | == Deletion safety == |
| 12 | '''Important''': The !ObjectListBase is deletion-save. This means you can delete as many objects and linked objects while iterating through any list as you like without running into trouble. This feature is achieved by using our own iterators ([wiki:ObjectListIterator] and [wiki:Iterator]). |
| 13 | |
| 14 | == ObjectListBase::Export == |
| 15 | ObjectListBase::Export is a small struct containing a pointer to the list and one list-element. With this you can create an [wiki:Iterator]. The Export struct is somehow a ''link'' to a specific object in a specific list. In STL, iterators have the same function. |
| 16 | |
| 17 | == Functions == |
| 18 | The following functions are used to work with [wiki:Iterator]. They all return an instance of ObjectListBase::Export, but you don't have to care about the internals, just assign it to an [wiki:Iterator]. |
| 19 | * '''begin()''': Returns an Export link to the first object in the list |
| 20 | * '''end()''': Returns an Export link to the list-element '''after''' the last object in the list |
| 21 | * '''rbegin()''': Returns an Export link to the last object in the list |
| 22 | * '''rend()''': Returns an Export link to the list-element '''before''' the first object in the list |
| 23 | |
| 24 | See [wiki:Iterator] for more information about the usage of those functions. |