Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgSList< T, SIZE > Class Template Reference

#include <SgSList.h>

List of all members.


Detailed Description

template<typename T, int SIZE>
class SgSList< T, SIZE >

Static list not using dynamic memory allocation.

Elements need to have a default constructor. They should be value-types, not entity-types, because operations like Clear() do not call the destructor of the old elements immediately.

Definition at line 20 of file SgSList.h.

Public Member Functions

 SgSList ()
 SgSList (const T &val)
 Construct list with one element.
 SgSList (const SgSList< T, SIZE > &list)
SgSListoperator= (const SgSList &list)
bool operator== (const SgSList &list) const
bool operator!= (const SgSList &list) const
T & operator[] (int index)
const T & operator[] (int index) const
void Clear ()
bool Contains (const T &val) const
bool Exclude (const T &val)
 Remove first occurrence of a value.
void Include (const T &val)
 PushBack value at the end of the list if it's not already in the list.
SgSList Intersect (const SgSList< T, SIZE > &list) const
 Build intersection with other list.
bool IsEmpty () const
T & Last ()
const T & Last () const
int Length () const
void PopBack ()
 Remove the last element of the list.
void PushBack (const T &val)
template<int SIZE2>
void PushBackList (const SgSList< T, SIZE2 > &list)
 Push back all elements of another list.
void RemoveFirst (const T &val)
 Remove first occurence of a value.
void Resize (int length)
 Resize list.
bool SameElements (const SgSList &list) const
void SetTo (const T &val)
void Sort ()

Private Attributes

int m_len
m_array [SIZE]

Friends

class Iterator
class NonConstIterator

Classes

class  Iterator
 Const iterator. More...
class  NonConstIterator
 Non-const iterator. More...


Constructor & Destructor Documentation

template<typename T, int SIZE>
SgSList< T, SIZE >::SgSList (  ) 

Definition at line 207 of file SgSList.h.

template<typename T, int SIZE>
SgSList< T, SIZE >::SgSList ( const T &  val  )  [explicit]

Construct list with one element.

Definition at line 213 of file SgSList.h.

References SgSList< T, SIZE >::m_array, SgSList< T, SIZE >::m_len, and SgSList< T, SIZE >::SetTo().

template<typename T, int SIZE>
SgSList< T, SIZE >::SgSList ( const SgSList< T, SIZE > &  list  ) 

Definition at line 221 of file SgSList.h.


Member Function Documentation

template<typename T, int SIZE>
void SgSList< T, SIZE >::Clear (  ) 

Definition at line 273 of file SgSList.h.

References SgSList< T, SIZE >::m_len.

template<typename T, int SIZE>
bool SgSList< T, SIZE >::Contains ( const T &  val  )  const

Definition at line 279 of file SgSList.h.

References SgSList< T, SIZE >::m_array, and SgSList< T, SIZE >::m_len.

Referenced by SgSList< T, SIZE >::Include(), SgSList< T, SIZE >::Intersect(), and SgSList< T, SIZE >::SameElements().

template<typename T, int SIZE>
bool SgSList< T, SIZE >::Exclude ( const T &  val  ) 

Remove first occurrence of a value.

Like RemoveFirst, but more efficient and does not preserve order of remaining elements. The first occurrence of the value is replaced by the last element.

Returns:
false, if element was not found

Definition at line 290 of file SgSList.h.

References SgSList< T, SIZE >::m_array, and SgSList< T, SIZE >::m_len.

template<typename T, int SIZE>
void SgSList< T, SIZE >::Include ( const T &  val  ) 

PushBack value at the end of the list if it's not already in the list.

Definition at line 307 of file SgSList.h.

References SgSList< T, SIZE >::Contains(), and SgSList< T, SIZE >::PushBack().

template<typename T, int SIZE>
SgSList< T, SIZE > SgSList< T, SIZE >::Intersect ( const SgSList< T, SIZE > &  list  )  const

Build intersection with other list.

List may not contain duplicate entries.

Definition at line 314 of file SgSList.h.

References SgSList< T, SIZE >::Contains(), SgSList< T, SIZE >::m_array, SgSList< T, SIZE >::m_len, SgSList< T, SIZE >::PushBack(), and SG_ASSERT.

template<typename T, int SIZE>
bool SgSList< T, SIZE >::IsEmpty (  )  const

Definition at line 329 of file SgSList.h.

References SgSList< T, SIZE >::m_len.

template<typename T, int SIZE>
const T & SgSList< T, SIZE >::Last (  )  const

Definition at line 342 of file SgSList.h.

References SgSList< T, SIZE >::m_array, SgSList< T, SIZE >::m_len, and SG_ASSERT.

template<typename T, int SIZE>
T & SgSList< T, SIZE >::Last (  ) 

Definition at line 335 of file SgSList.h.

References SgSList< T, SIZE >::m_array, SgSList< T, SIZE >::m_len, and SG_ASSERT.

template<typename T, int SIZE>
int SgSList< T, SIZE >::Length (  )  const

Definition at line 349 of file SgSList.h.

References SgSList< T, SIZE >::m_len.

template<typename T, int SIZE>
bool SgSList< T, SIZE >::operator!= ( const SgSList< T, SIZE > &  list  )  const

Definition at line 251 of file SgSList.h.

References SgSList< T, SIZE >::operator==().

template<typename T, int SIZE>
SgSList< T, SIZE > & SgSList< T, SIZE >::operator= ( const SgSList< T, SIZE > &  list  ) 

Definition at line 227 of file SgSList.h.

References SgSList< T, SIZE >::m_array, and SgSList< T, SIZE >::m_len.

template<typename T, int SIZE>
bool SgSList< T, SIZE >::operator== ( const SgSList< T, SIZE > &  list  )  const

Definition at line 238 of file SgSList.h.

References SgSList< T, SIZE >::m_array, and SgSList< T, SIZE >::m_len.

Referenced by SgSList< T, SIZE >::operator!=().

template<typename T, int SIZE>
const T & SgSList< T, SIZE >::operator[] ( int  index  )  const

Definition at line 265 of file SgSList.h.

References SgSList< T, SIZE >::m_array, SgSList< T, SIZE >::m_len, and SG_ASSERT.

template<typename T, int SIZE>
T & SgSList< T, SIZE >::operator[] ( int  index  ) 

Definition at line 257 of file SgSList.h.

References SgSList< T, SIZE >::m_array, SgSList< T, SIZE >::m_len, and SG_ASSERT.

template<typename T, int SIZE>
void SgSList< T, SIZE >::PopBack (  ) 

Remove the last element of the list.

Does not return the last element for efficiency. To get the last element, use Last() before calling PopBack().

Definition at line 355 of file SgSList.h.

References SgSList< T, SIZE >::m_len, and SG_ASSERT.

template<typename T, int SIZE>
void SgSList< T, SIZE >::PushBack ( const T &  val  ) 

Definition at line 362 of file SgSList.h.

References SgSList< T, SIZE >::m_array, SgSList< T, SIZE >::m_len, and SG_ASSERT.

Referenced by SgSList< T, SIZE >::Include(), SgSList< T, SIZE >::Intersect(), and SgSList< T, SIZE >::PushBackList().

template<typename T, int SIZE>
template<int SIZE2>
void SgSList< T, SIZE >::PushBackList ( const SgSList< T, SIZE2 > &  list  ) 

Push back all elements of another list.

Works with lists of different maximum sizes. Requires: Total resulting number of elements will fit into the target list.

Definition at line 370 of file SgSList.h.

References SgSList< T, SIZE >::PushBack().

template<typename T, int SIZE>
void SgSList< T, SIZE >::RemoveFirst ( const T &  val  ) 

Remove first occurence of a value.

Preserves order of remaining elements.

See also:
Exclude

Definition at line 377 of file SgSList.h.

References SgSList< T, SIZE >::m_array, and SgSList< T, SIZE >::m_len.

template<typename T, int SIZE>
void SgSList< T, SIZE >::Resize ( int  length  ) 

Resize list.

If new length is greater than current length, then the elements at a place greater than the old length are not initialized, they are just the old elements at this place. This is necessary if elements are re-used for efficiency and will be initialized later.

Definition at line 392 of file SgSList.h.

References SgSList< T, SIZE >::m_len, and SG_ASSERT.

template<typename T, int SIZE>
bool SgSList< T, SIZE >::SameElements ( const SgSList< T, SIZE > &  list  )  const

Definition at line 400 of file SgSList.h.

References SgSList< T, SIZE >::Contains(), SgSList< T, SIZE >::m_array, and SgSList< T, SIZE >::m_len.

template<typename T, int SIZE>
void SgSList< T, SIZE >::SetTo ( const T &  val  ) 

Definition at line 412 of file SgSList.h.

References SgSList< T, SIZE >::m_array, and SgSList< T, SIZE >::m_len.

Referenced by SgSList< T, SIZE >::SgSList().

template<typename T, int SIZE>
void SgSList< T, SIZE >::Sort (  ) 

Definition at line 419 of file SgSList.h.

References SgSList< T, SIZE >::m_array, and SgSList< T, SIZE >::m_len.


Friends And Related Function Documentation

template<typename T, int SIZE>
friend class Iterator [friend]

Definition at line 144 of file SgSList.h.

template<typename T, int SIZE>
friend class NonConstIterator [friend]

Definition at line 145 of file SgSList.h.


Member Data Documentation

template<typename T, int SIZE>
T SgSList< T, SIZE >::m_array[SIZE] [private]

Definition at line 149 of file SgSList.h.

Referenced by SgSList< T, SIZE >::Contains(), SgSList< T, SIZE >::Exclude(), SgSList< T, SIZE >::Intersect(), SgSList< T, SIZE >::Last(), SgSList< T, SIZE >::operator=(), SgSList< T, SIZE >::operator==(), SgSList< T, SIZE >::operator[](), SgSList< T, SIZE >::PushBack(), SgSList< T, SIZE >::RemoveFirst(), SgSList< T, SIZE >::SameElements(), SgSList< T, SIZE >::SetTo(), SgSList< T, SIZE >::SgSList(), and SgSList< T, SIZE >::Sort().

template<typename T, int SIZE>
int SgSList< T, SIZE >::m_len [private]

Definition at line 147 of file SgSList.h.

Referenced by SgSList< T, SIZE >::Clear(), SgSList< T, SIZE >::Contains(), SgSList< T, SIZE >::Exclude(), SgSList< T, SIZE >::Intersect(), SgSList< T, SIZE >::IsEmpty(), SgSList< T, SIZE >::Last(), SgSList< T, SIZE >::Length(), SgSList< T, SIZE >::operator=(), SgSList< T, SIZE >::operator==(), SgSList< T, SIZE >::operator[](), SgSList< T, SIZE >::PopBack(), SgSList< T, SIZE >::PushBack(), SgSList< T, SIZE >::RemoveFirst(), SgSList< T, SIZE >::Resize(), SgSList< T, SIZE >::SameElements(), SgSList< T, SIZE >::SetTo(), SgSList< T, SIZE >::SgSList(), and SgSList< T, SIZE >::Sort().


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


17 Jun 2010 Doxygen 1.4.7