TArrayBase< T > Class Template Reference
[Template Containers]

Template array base class. More...

#include <tarray.h>

Inheritance diagram for TArrayBase< T >:
Inheritance graph
[legend]

Public Member Functions

 TArrayBase (int32 initSize=0, int32 delta=kDefaultDelta)
 ~TArrayBase ()
TArrayBase< T > & operator= (const TArrayBase< T > &)
void delta (int32 d)
 Set delta value.
int32 delta () const
 Get delta value.
void enableExponentialGroth (bool state)
 Instead of using delta, always double the array size.
bool hasExponentialGroth () const
bool resize (int32 newSize)
 Resize the array.
virtual int32 total () const
virtual bool isEmpty () const
virtual bool add (const T &)
virtual bool remove (const T &)
virtual bool remove (const TIterator< T > &)
virtual bool removeAt (int32 index)
virtual void removeAll ()
bool removeRange (int32 from, int32 to)
 Remove items from index 'from' to index 'to'.
virtual T & at (int32) const
virtual T & lookup (const T &item) const
virtual bool contains (const T &item) const
virtual int32 occurrences (const T &item) const
virtual TIterator< T > * newIterator () const
virtual int32 shouldGo (const T &item) const =0
 Get index for potential item.
virtual int32 index (const T &item) const =0
 Get index of item.
T & first () const
T & last () const

Static Public Attributes

static const int32 kDefaultDelta = 10
static const int32 kExponentialDelta = -1

Protected Member Functions

int32 indexSorted (const T &) const
int32 indexUnsorted (const T &) const
int32 shouldGoSorted (const T &) const
 Get index for potential item.
int32 shouldGoUnsorted (const T &) const
 Get index for potential item.
void doQuickSort ()
bool doInsertAt (int32 index, const T &)
 Insert item at index.

Static Protected Member Functions

static int cmpData (const void *, const void *)
 Quick sort compare function.

Protected Attributes

int32 _delta
 Delta value.
int32 _total
 Number of items.
T * _entries
 Array of "T" pointers.

Detailed Description

template<class T>
class Steinberg::TArrayBase< T >

Template array base class.

See also:
TArray, TOrderedArray, TSortableArray, TArrayIterator

Constructor & Destructor Documentation

TArrayBase ( int32  sz = 0,
int32  dt = kDefaultDelta 
) [inline]

"TArrayBase" is the default constructor.

Parameters:
sz : initial size of array
dt : initial delta value for automatic growing.
~TArrayBase (  )  [inline]

Member Function Documentation

TArrayBase< T > & operator= ( const TArrayBase< T > &  arr  )  [inline]

"=" assignment operator copies the specified array into this array.

void delta ( int32  dt  )  [inline]

Set delta value.

"delta" sets a new delta value for automatic growing.

int32 delta (  )  const [inline]

Get delta value.

"delta" returns the current delta value.

void enableExponentialGroth ( bool  state  )  [inline]

Instead of using delta, always double the array size.

bool hasExponentialGroth (  )  const [inline]
bool resize ( int32  newsize  )  [inline]

Resize the array.

"resize" resizes the storage allocated for this array.

int32 total (  )  const [inline, virtual]

Return number of items.

"total" returns the number of items in this array.

Reimplemented from TContainer< T >.

bool isEmpty (  )  const [inline, virtual]

Is container empty?

"isEmpty" returns whether or not this array has any items in it.

Reimplemented from TContainer< T >.

bool add ( const T &  rObj  )  [inline, virtual]

Add item to container.

"add" appends the specified item to this array.

Implements TContainer< T >.

bool remove ( const T &  rObj  )  [inline, virtual]

Remove equal item.

"remove" removes the first occurrence of an item equal to the specified item in the array.

Implements TContainer< T >.

bool remove ( const TIterator< T > &  iter  )  [inline, virtual]

Remove item at current iterator position.

"remove" removes the item pointed to by the specified iterator.

Implements TContainer< T >.

bool removeAt ( int32  idx  )  [inline, virtual]

Remove item at given index.

"removeAt" removes the item at the specified index.

Implements TContainer< T >.

void removeAll (  )  [inline, virtual]

Remove all items from list.

"removeAll" sets the number of items in this array to zero.

Implements TContainer< T >.

bool removeRange ( int32  from,
int32  to 
) [inline]

Remove items from index 'from' to index 'to'.

"removeRange" removes all items in the specified index range including the index boundaries

Parameters:
from : start index
to,: end index
Returns:
success
T & at ( int32  idx  )  const [inline, virtual]

Get item at index.

"at" returns the item at the specified index.

Returns:
item found or error object

Reimplemented from TContainer< T >.

T & lookup ( const T &  rObj  )  const [inline, virtual]

Searches for the item equal to the specified item in the list and returns the first occurrence.

"lookup" returns the first occurrence of the item equal to the specified item in the array.

Returns:
item found or error object

Reimplemented from TContainer< T >.

bool contains ( const T &  rObj  )  const [inline, virtual]

See if container has equal item.

"contains" checks the array for an item equal to the input.

Reimplemented from TContainer< T >.

int32 occurrences ( const T &  rObj  )  const [inline, virtual]

Count occurrences of equal items.

"occurrences" counts the number of occurrences of items equal to the specified item.

Reimplemented from TContainer< T >.

TIterator< T > * newIterator (  )  const [inline, virtual]

Create container iterator instance.

"newIterator" creates and returns a new array iterator.

Implements TContainer< T >.

virtual int32 shouldGo ( const T &  item  )  const [pure virtual]
virtual int32 index ( const T &  item  )  const [pure virtual]
T& first (  )  const [inline]
T& last (  )  const [inline]
int cmpData ( const void *  obj1,
const void *  obj2 
) [inline, static, protected]

Quick sort compare function.

"cmpData" is called by the standard library qsort function for sorting the array into ascending order.

int32 indexSorted ( const T &  rObj  )  const [inline, protected]

"indexSorted" returns the index of the first occurrence of an item equal to the specified item.

Returns:
index found or "-1" if not found
int32 indexUnsorted ( const T &  rObj  )  const [inline, protected]

"indexUnsorted" returns the index of the first occurrence of an item equal to the specified item.

Returns:
index found or "-1" if not found
int32 shouldGoSorted ( const T &  rObj  )  const [inline, protected]

Get index for potential item.

"shouldGoSorted" returns the index for a potential insert/add operation using ">", "<", and "==" operators

Returns:
index found
int32 shouldGoUnsorted ( const T &   )  const [inline, protected]

Get index for potential item.

"shouldGoUnsorted" returns the index for a potential insert/add operation

Returns:
index of last event + 1 "append item"
void doQuickSort (  )  [inline, protected]

"quickSort" uses the standard library to perform a quick sort on this array.

bool doInsertAt ( int32  idx,
const T &  rObj 
) [inline, protected]

Insert item at index.

inserts the specified item at the specified index shifting the other items to make room.


Field Documentation

const int32 kDefaultDelta = 10 [static]
const int32 kExponentialDelta = -1 [static]
int32 _delta [protected]

Delta value.

int32 _total [protected]

Number of items.

T* _entries [protected]

Array of "T" pointers.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.