ODIN
Public Types | Public Member Functions | List of all members

#include <tjlist.h>

Inheritance diagram for List< I, P, R >:
Inheritance graph
[legend]

Public Types

typedef STD_list< P >::iterator iter
 
typedef STD_list< P >::const_iterator constiter
 

Public Member Functions

 List ()
 
 ~List ()
 
Listoperator= (const List &l)
 
Listclear ()
 
Listappend (R item)
 
Listremove (R item)
 
unsigned int size () const
 
iter get_begin ()
 
iter get_end ()
 
constiter get_const_begin () const
 
constiter get_const_end () const
 

Detailed Description

template<class I, class P, class R>
class List< I, P, R >

This template class handles a list of references to other objects. In contrast to the STL list, it stores only pointers to the members of the list instead of storing copies. That means, if a member of the list is modified, the property of the whole list changes. This list is well suited to build blocks of objects that will be modified after they have been inserted into the list, e.g. a list of parameters.

If you want to use this list, i.e. create an instantiation for a specific data type T, you must first decide whether to use const objects, i.e. which will not changed via the list, or non-const objects that can be modified via the list. In the former case, create a list by instatiating

List<T,const T*,const T&>

otherwise

List<T,T*,T&>

Classes which are to be inserted into the list must be derived from the base class

ListItem<T>

This construct ensures that whenever an item of the list is deleted, it deregisters itself from the list.

Definition at line 105 of file tjlist.h.

Member Typedef Documentation

◆ constiter

template<class I , class P , class R >
typedef STD_list<P>::const_iterator List< I, P, R >::constiter

Iterator for const lists

Definition at line 156 of file tjlist.h.

◆ iter

template<class I , class P , class R >
typedef STD_list<P>::iterator List< I, P, R >::iter

Iterator for mutable lists

Definition at line 151 of file tjlist.h.

Constructor & Destructor Documentation

◆ List()

template<class I , class P , class R >
List< I, P, R >::List

Constructs an empty List

Definition at line 39 of file tjlist_code.h.

◆ ~List()

template<class I , class P , class R >
List< I, P, R >::~List

Destructor

Definition at line 47 of file tjlist_code.h.

Member Function Documentation

◆ append()

template<class I , class P , class R >
List< I, P, R > & List< I, P, R >::append ( item)

Appends a reference to 'item'

Definition at line 82 of file tjlist_code.h.

◆ clear()

template<class I , class P , class R >
List< I, P, R > & List< I, P, R >::clear

Removes all items from the list

Definition at line 65 of file tjlist_code.h.

◆ get_begin()

template<class I , class P , class R >
iter List< I, P, R >::get_begin ( )
inline

returns an iterator that points to the head of the list (for mutable lists)

Definition at line 161 of file tjlist.h.

◆ get_const_begin()

template<class I , class P , class R >
constiter List< I, P, R >::get_const_begin ( ) const
inline

returns an iterator that points to the head of the list (for const lists)

Definition at line 171 of file tjlist.h.

◆ get_const_end()

template<class I , class P , class R >
constiter List< I, P, R >::get_const_end ( ) const
inline

returns an iterator that points to the end of the list (for const lists)

Definition at line 176 of file tjlist.h.

◆ get_end()

template<class I , class P , class R >
iter List< I, P, R >::get_end ( )
inline

returns an iterator that points to the end of the list (for mutable lists)

Definition at line 166 of file tjlist.h.

◆ operator=()

template<class I , class P , class R >
List< I, P, R > & List< I, P, R >::operator= ( const List< I, P, R > &  l)

Assignment operator that will result in a list that holds references to all objects for which 'l' contains a reference

Definition at line 56 of file tjlist_code.h.

◆ remove()

template<class I , class P , class R >
List< I, P, R > & List< I, P, R >::remove ( item)

Removes all references to 'item'

Definition at line 93 of file tjlist_code.h.

◆ size()

template<class I , class P , class R >
unsigned int List< I, P, R >::size ( ) const
inline

Returns the number of items in the list

Definition at line 145 of file tjlist.h.


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