Version 1 (modified by landauf, 16 years ago) (diff) |
---|
ObjectListBase
TracNav(TracNav/TOC_Development)?
Information
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 CoreIncludes) in the constructor.
The list of a given class is located in the Identifier of the class.
ObjectListBase threats all objects as OrxonoxClasses and doesn't care about the real class. See ObjectList for a class-specific wrapper to ObjectListBase.
Deletion safety
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 (ObjectListIterator and Iterator).
ObjectListBase::Export
ObjectListBase::Export is a small struct containing a pointer to the list and one list-element. With this you can create an Iterator. The Export struct is somehow a link to a specific object in a specific list. In STL, iterators have the same function.
Functions
The following functions are used to work with Iterator. They all return an instance of ObjectListBase::Export, but you don't have to care about the internals, just assign it to an Iterator.
- begin(): Returns an Export link to the first object in the list
- end(): Returns an Export link to the list-element after the last object in the list
- rbegin(): Returns an Export link to the last object in the list
- rend(): Returns an Export link to the list-element before the first object in the list
See Iterator for more information about the usage of those functions.
Attachments (1)
- ObjectListBase.png (20.0 KB) - added by landauf 16 years ago.
Download all attachments as: .zip