Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Private Member Functions | Private Attributes | List of all members
orxonox::ObjectListBase Class Reference

The ObjectListBase contains all objects of a given class. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/object/ObjectListBase.h>

Public Member Functions

 ObjectListBase ()
 Constructor: Sets default values. More...
 
 ~ObjectListBase ()
 Destructor: Detaches all list-elements, but doesn't delete them (nor the objects). More...
 
void addElement (ObjectListBaseElement *element)
 Adds a new object to the end of the list. More...
 
ObjectListBaseElementbegin () const
 Returns a pointer to the first element in the list. Works only with Iterator. More...
 
ObjectListBaseElementend () const
 Returns a pointer to the element after the last element in the list. Works only with Iterator. More...
 
ObjectListBaseElementrbegin () const
 Returns a pointer to the last element in the list. Works only with Iterator. More...
 
void registerRemovalListener (ObjectListElementRemovalListener *listener)
 
void removeElement (ObjectListBaseElement *element)
 Removes the element from the list. More...
 
ObjectListBaseElementrend () const
 Returns a pointer to the element in front of the first element in the list. Works only with Iterator. More...
 
size_t size () const
 
void unregisterRemovalListener (ObjectListElementRemovalListener *listener)
 

Private Member Functions

void notifyRemovalListeners (ObjectListBaseElement *element) const
 Notifies all listeners that the given element is about to get removed. More...
 

Private Attributes

ObjectListBaseElementfirst_
 The first element in the list. More...
 
ObjectListBaseElementlast_
 The last element in the list. More...
 
std::vector< ObjectListElementRemovalListener * > listeners_
 A list of Iterators pointing on an element in this list. More...
 
size_t size_
 The number of elements in the list. More...
 

Detailed Description

The ObjectListBase contains all objects of a given class.

The ObjectListBase is used by Identifiers to store all objects of their class. You can use Identifier::getObjects() to get the object-list from an Identifier. Use Iterator<T> to iterate through them.

Alternatively you can also use the static helper class ObjectList<T> to get the list of all objects of type T. Use ObjectListIterator<T> or Iterator<T> to iterate through them.

Constructor & Destructor Documentation

orxonox::ObjectListBase::ObjectListBase ( )

Constructor: Sets default values.

orxonox::ObjectListBase::~ObjectListBase ( )

Destructor: Detaches all list-elements, but doesn't delete them (nor the objects).

Member Function Documentation

void orxonox::ObjectListBase::addElement ( ObjectListBaseElement element)

Adds a new object to the end of the list.

Parameters
elementThe element to add
ObjectListBaseElement* orxonox::ObjectListBase::begin ( ) const
inline

Returns a pointer to the first element in the list. Works only with Iterator.

ObjectListBaseElement* orxonox::ObjectListBase::end ( ) const
inline

Returns a pointer to the element after the last element in the list. Works only with Iterator.

void orxonox::ObjectListBase::notifyRemovalListeners ( ObjectListBaseElement element) const
private

Notifies all listeners that the given element is about to get removed.

Parameters
elementThe element that gets removed This is mainly used for iterators which point at the removed element
ObjectListBaseElement* orxonox::ObjectListBase::rbegin ( ) const
inline

Returns a pointer to the last element in the list. Works only with Iterator.

void orxonox::ObjectListBase::registerRemovalListener ( ObjectListElementRemovalListener listener)
inline
void orxonox::ObjectListBase::removeElement ( ObjectListBaseElement element)

Removes the element from the list.

ObjectListBaseElement* orxonox::ObjectListBase::rend ( ) const
inline

Returns a pointer to the element in front of the first element in the list. Works only with Iterator.

size_t orxonox::ObjectListBase::size ( ) const
inline
void orxonox::ObjectListBase::unregisterRemovalListener ( ObjectListElementRemovalListener listener)
inline

Member Data Documentation

ObjectListBaseElement* orxonox::ObjectListBase::first_
private

The first element in the list.

ObjectListBaseElement* orxonox::ObjectListBase::last_
private

The last element in the list.

std::vector<ObjectListElementRemovalListener*> orxonox::ObjectListBase::listeners_
private

A list of Iterators pointing on an element in this list.

size_t orxonox::ObjectListBase::size_
private

The number of elements in the list.


The documentation for this class was generated from the following files: