Planet
navi homeaboutscreenshotsdownloaddevelopmentforum

ObjectList

TracNav(TracNav/TOC_Development)?

Description

ObjectList is a wrapper to ObjectListBase. ObjectListBase contains all objects of a given class, but threats the objects as OrxonoxClasses. ObjectList in contrary is a template and knows about the correct class. By definition theres only one ObjectList per class. This is easy to proof because ObjectList<T> just redirects to ClassIdentifier<T>::objects_ (which is an ObjectListBase).

So, in other words, ObjectList<T> is just a shortcut for:

ClassIdentifier<T>::getIdentifier()->getObjects()

Functions

ObjectList provides the same functions as ObjectListBase but doesn't return an Export struct but a class-specific list element pointer which can not only be used by Iterator but also by ObjectListIterator. This is important because ObjectListIterator is much more performant than Iterator.

  • begin(): Returns a pointer to the first element in the list
  • end(): Returns a pointer to the list-element after the last element in the list
  • rbegin(): Returns a pointer to the last element in the list
  • rend(): Returns a pointer to the list-element before the first element in the list

See Iterator and ObjectListIterator for more information about the usage of those functions.

Illustration

The illustration shows how the ObjectList<T> uses ClassIdentifier<T> to get the ObjectListBase. Because ObjectList<T> knows about the right class (T) it casts the list element to the right type and gets the object pointer without dynamic_cast.

Last modified 8 years ago Last modified on Sep 28, 2008, 7:43:18 PM

Attachments (1)

Download all attachments as: .zip