StableArray Class Template Reference

#include <StableArray.h>

List of all members.


Detailed Description

template<class T>
class SimTK::StableArray< T >

StableArray<T> is like std::vector<T> but more stable in two ways:

The above means that once you insert an item (meaning that a copy of it resides in the StableArray), you can save the address of that copy and/or its index and be certain that adding or deleting other items will leave those unaffected. Once an item has been erased, however, we will feel free to reuse both the heap it once consumed and its index.

As your punishment for the crime of enjoying this stability guarantee, consecutive elements of a StableArray are not consecutive in memory.

CAUTION: this is not suited for use across binary interfaces because the implementation is fully exposed.

Public Member Functions

 StableArray ()
 StableArray (size_t z, const T &ival=T())
 StableArray (const StableArray &s)
StableArrayoperator= (const StableArray &s)
 ~StableArray ()
bool empty () const
bool empty (size_t i) const
size_t size () const
size_t nItems () const
void resize (size_t newz, const T &ival=T())
void clear ()
void push_back (const T &t)
void pop_back ()
void insertAt (size_t i, const T &t)
size_t findFreeSlot () const
size_t findNextItem (size_t i)
size_t insert (const T &t)
void erase (size_t i)
const T & front () const
T & front ()
const T & back () const
T & back ()
const T & operator[] (size_t i) const
T & operator[] (size_t i)


Constructor & Destructor Documentation

StableArray (  )  [inline]

StableArray ( size_t  z,
const T &  ival = T() 
) [inline, explicit]

References fkinkryx::i, and C::T.

StableArray ( const StableArray< T > &  s  )  [inline]

~StableArray (  )  [inline]

References StableArray::clear().


Member Function Documentation

StableArray& operator= ( const StableArray< T > &  s  )  [inline]

bool empty (  )  const [inline]

bool empty ( size_t  i  )  const [inline]

size_t size (  )  const [inline]

size_t nItems (  )  const [inline]

void resize ( size_t  newz,
const T &  ival = T() 
) [inline]

void clear (  )  [inline]

void push_back ( const T &  t  )  [inline]

References C::T.

Referenced by StableArray::insertAt().

void pop_back (  )  [inline]

References StableArray::empty().

Referenced by StableArray::erase().

void insertAt ( size_t  i,
const T &  t 
) [inline]

size_t findFreeSlot (  )  const [inline]

size_t findNextItem ( size_t  i  )  [inline]

Referenced by StableArray::front().

size_t insert ( const T &  t  )  [inline]

void erase ( size_t  i  )  [inline]

const T& front (  )  const [inline]

T& front (  )  [inline]

const T& back (  )  const [inline]

References StableArray::empty().

T& back (  )  [inline]

References StableArray::empty().

const T& operator[] ( size_t  i  )  const [inline]

T& operator[] ( size_t  i  )  [inline]


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

Generated on Fri Sep 26 07:44:29 2008 for SimTKcore by  doxygen 1.5.6