Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 6 (modified by landauf, 8 years ago) (diff)

fixed links

ObjectListBase

Description

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.

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.

Illustration

The illustration shows how the elements of the list are connected and to which elements the four functions of ObjectListBase redirect.

Attachments (1)

Download all attachments as: .zip