Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Xabsl2Array< T > Class Template Reference

The class implements a dynamic array. More...

#include <Xabsl2Array.h>

List of all members.

Public Member Functions

 Xabsl2Array ()
 Constructor.

 ~Xabsl2Array ()
 Destructor.

void clear ()
 Clears the array.

getElement (const char *name, T defaultValue) const
 Returns the value for a given name.

getElement (const char *name) const
 Returns the value for a given name.

getElement (int pos) const
 Returns the value for a given array position.

Xabsl2ArrayElement< T > * getPElement (const char *name)
 Returns a pointer to the array element for a given name.

const char * getName (int pos) const
 Returns the name of an element.

void append (const char *name, T element)
 The function appends a new element to the array.

void setElement (const char *name, T value)
 The function sets the value of an element in the array.

void setElement (int pos, T value)
 The function sets the value of an element in the array.

int getSize () const
 The function returns the number of elements in the array.

operator[] (int pos) const
 Returns the value for a given array position.

bool exists (const char *name) const
 Returns whether an element for the given name exists.


Protected Member Functions

int find (const char *name) const
 Returns the index of an element with the given name.


Protected Attributes

Xabsl2ArrayElement< T > ** data
 The array.

int usedSize
 The number of elements in the array.

int allocatedSize
 The number of elements in the array.


Detailed Description

template<class T>
class Xabsl2Array< T >

The class implements a dynamic array.

Each array element can have a text label.

Author:
Matthias Jüngel

Martin Lötzsch

Thomas Röfer

Definition at line 78 of file Xabsl2Array.h.


Constructor & Destructor Documentation

template<class T>
Xabsl2Array< T >::Xabsl2Array  )  [inline]
 

Constructor.

Definition at line 82 of file Xabsl2Array.h.

template<class T>
Xabsl2Array< T >::~Xabsl2Array  )  [inline]
 

Destructor.

Definition at line 90 of file Xabsl2Array.h.


Member Function Documentation

template<class T>
void Xabsl2Array< T >::clear  )  [inline]
 

Clears the array.

Definition at line 98 of file Xabsl2Array.h.

template<class T>
T Xabsl2Array< T >::getElement const char *  name,
defaultValue
const [inline]
 

Returns the value for a given name.

If no element exists for the name, the default value is returned.

Parameters:
name The name element
defaultValue The value that is returned if no element exists for the name.
Returns:
Either the element found or the default value.

Definition at line 115 of file Xabsl2Array.h.

Referenced by Xabsl2State::create(), Xabsl2Array< Xabsl2State * >::getElement(), Xabsl2Array< Xabsl2State * >::operator[](), and Xabsl2TransitionToState::Xabsl2TransitionToState().

template<class T>
T Xabsl2Array< T >::getElement const char *  name  )  const [inline]
 

Returns the value for a given name.

Note that the function crashes if the element does not exist.

Parameters:
name The name of the element

Definition at line 129 of file Xabsl2Array.h.

template<class T>
T Xabsl2Array< T >::getElement int  pos  )  const [inline]
 

Returns the value for a given array position.

Note that the function crashes if the required position is bigger than the size of the array.

Definition at line 139 of file Xabsl2Array.h.

template<class T>
Xabsl2ArrayElement<T>* Xabsl2Array< T >::getPElement const char *  name  )  [inline]
 

Returns a pointer to the array element for a given name.

Note that the function crashes if the element does not exist

Parameters:
name the name of the element

Definition at line 149 of file Xabsl2Array.h.

Referenced by Xabsl2OptionParameterRef::Xabsl2OptionParameterRef().

template<class T>
const char* Xabsl2Array< T >::getName int  pos  )  const [inline]
 

Returns the name of an element.

Definition at line 155 of file Xabsl2Array.h.

Referenced by Xabsl2Array< Xabsl2State * >::find().

template<class T>
void Xabsl2Array< T >::append const char *  name,
element
[inline]
 

The function appends a new element to the array.

Parameters:
name A string label for the element.
element The new element.

Definition at line 165 of file Xabsl2Array.h.

template<class T>
void Xabsl2Array< T >::setElement const char *  name,
value
[inline]
 

The function sets the value of an element in the array.

Note that the function crashes if the element does not exist.

Parameters:
name A string label for the element.
value The new element.

Definition at line 185 of file Xabsl2Array.h.

Referenced by Xabsl2Array< Xabsl2State * >::setElement().

template<class T>
void Xabsl2Array< T >::setElement int  pos,
value
[inline]
 

The function sets the value of an element in the array.

Note that the function crashes if the element does not exist.

Parameters:
pos The position of the element in the array.
value The new element.

Definition at line 196 of file Xabsl2Array.h.

template<class T>
int Xabsl2Array< T >::getSize  )  const [inline]
 

The function returns the number of elements in the array.

Returns:
The length of the list.

Definition at line 205 of file Xabsl2Array.h.

Referenced by Xabsl2Array< Xabsl2State * >::append(), Xabsl2Array< Xabsl2State * >::clear(), Xabsl2Array< Xabsl2State * >::find(), and Xabsl2Array< Xabsl2State * >::~Xabsl2Array().

template<class T>
T Xabsl2Array< T >::operator[] int  pos  )  const [inline]
 

Returns the value for a given array position.

Note that the function crashes if the required position is bigger than the size of the array.

Definition at line 212 of file Xabsl2Array.h.

template<class T>
bool Xabsl2Array< T >::exists const char *  name  )  const [inline]
 

Returns whether an element for the given name exists.

Definition at line 218 of file Xabsl2Array.h.

Referenced by Xabsl2State::create(), and Xabsl2OptionParameterRef::Xabsl2OptionParameterRef().

template<class T>
int Xabsl2Array< T >::find const char *  name  )  const [inline, protected]
 

Returns the index of an element with the given name.

Parameters:
name The name that is searched for.
Returns:
The index of the element of -1 if the name does not exist.

Definition at line 229 of file Xabsl2Array.h.

Referenced by Xabsl2Array< Xabsl2State * >::exists(), Xabsl2Array< Xabsl2State * >::getElement(), Xabsl2Array< Xabsl2State * >::getPElement(), and Xabsl2Array< Xabsl2State * >::setElement().


Member Data Documentation

template<class T>
Xabsl2ArrayElement<T>** Xabsl2Array< T >::data [protected]
 

The array.

Definition at line 238 of file Xabsl2Array.h.

template<class T>
int Xabsl2Array< T >::usedSize [protected]
 

The number of elements in the array.

Definition at line 241 of file Xabsl2Array.h.

template<class T>
int Xabsl2Array< T >::allocatedSize [protected]
 

The number of elements in the array.

Definition at line 241 of file Xabsl2Array.h.


The documentation for this class was generated from the following file:
Generated on Thu Sep 23 20:12:16 2004 for GT2004 by doxygen 1.3.6