Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 6 and Version 7 of code/doc/ObjectList


Ignore:
Timestamp:
Sep 27, 2008, 3:48:17 AM (16 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/doc/ObjectList

    v6 v7  
    44== Description ==
    55
    6 The [wiki:ObjectList] is a double-linked list used to store all objects of a given class. It's nothing special, we might use std::list as well, but it ensures a very fast deletion of objects. Just think of the list of all [wiki:BaseObject BaseObjects]: There might be at least 10'000 objects. If deleting means: "Iterate through the list until you find the stored object" this could result in up to (10'000^2^ / 2 = 50 mio) iterations.
     6!ObjectList is a wrapper to [wiki:ObjectListBase]. !ObjectListBase contains all objects of a given class, but threats the objects as [wiki:OrxonoxClass 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).
    77
    8 The [wiki:ObjectList] allows you to delete an entry by simply connecting the previous and the following entry. The associated entries and the related [wiki:ObjectList ObjectLists] of each object are stored in a [wiki:MetaObjectList]. The list gets provided by [wiki:OrxonoxClass].
    9 
    10 List-elements can be assigned to an [wiki:Iterator]. This allows you to easily iterate through all objects in an [wiki:ObjectList]. Read the related Wiki-page for more information.
     8So, in other words, !ObjectList<T> is just a shortcut for:
     9{{{
     10ClassIdentifier<T>::getIdentifier()->getObjects()
     11}}}
    1112
    1213== Functions ==
    13  * '''begin()'''/'''start()''': Returns the first list-element of the list
    14  * '''end()''': Returns the last list-element of the list
     14!ObjectList provides the same functions as !ObjectListBase but doesn't return an [wiki:ObjectListBase#ObjectListBase::Export Export] struct but a class-specific list element pointer which can not only be used by [wiki:Iterator] but also by [wiki:ObjectListIterator]. This is important because !ObjectListIterator is much more performant than Iterator.
     15
     16 * '''begin()''': Returns a pointer to the first element in the list
     17 * '''end()''': Returns a pointer to the list-element '''after''' the last element in the list
     18 * '''rbegin()''': Returns a pointer to the last element in the list
     19 * '''rend()''': Returns a pointer to the list-element '''before''' the first element in the list