Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Initial Version and Version 1 of ~archive/ObjectList


Ignore:
Timestamp:
Nov 27, 2007, 9:07:50 PM (16 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • ~archive/ObjectList

    v1 v1  
     1= ObjectList =
     2
     3The ObjectList is a generic container for Classes that are derived from BaseObject.
     4
     5Every object, that spcifies the registerObject-function is automatically registered to the ObjectList, and stored within it. (also see BaseObject about this)
     6
     7The fancy thing about the ObjectList is:
     8  1. One can get a list of all Objects of any type (as long as it is derived from BaseObject)
     9  1. One can check if an Object exists within a List.
     10  1. One can check if all allocated data is deleted again, or if it is just floting around somewhere.
     11
     12== Usage ==
     13  * Iterating through a List: (note that the iterator is a std::list<PNode*>::const_iterator and can be used like any other stl-iterator.)
     14{{{
     15#!cpp
     16 ObjectList<PNode>::const_iterator it;
     17 for (it = PNode::objectList().begin(); it != PNode::objectList().end(); ++it)
     18  (*it)->debug();
     19}}}
     20  * get an Object with some name
     21{{{
     22#!cpp
     23/// some class
     24ObjectListBase::getBaseObject("PNode", "Player"); // returns a BaseObject* to the first object of a class named PNode and an Object named Player.
     25/// defined class: much faster, and way more powerfull!
     26PNode::objectList().getObject("Player"); // returns a PNode* to an Object named Player
     27}}}