cgma
SimpleArray< T > Class Template Reference

List of all members.

Public Types

typedef T * iterator
typedef const T * const_iterator
typedef T * iterator
typedef const T * const_iterator

Public Member Functions

 SimpleArray ()
 ~SimpleArray ()
operator[] (unsigned int lhs)
void reset ()
int size ()
 SimpleArray ()
 SimpleArray (unsigned s)
 ~SimpleArray ()
T ** ptr ()
int & size ()
int size () const
int & capacity ()
int capacity () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
T & operator[] (unsigned idx)
operator[] (unsigned idx) const
 SimpleArray ()
 SimpleArray (unsigned s)
 ~SimpleArray ()
T ** ptr ()
int & size ()
int size () const
int & capacity ()
int capacity () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
T & operator[] (unsigned idx)
operator[] (unsigned idx) const

Public Attributes

T * array
int array_alloc
int array_size

Private Attributes

T * arr
int arrSize
int arrAllocated

Detailed Description

template<typename T>
class SimpleArray< T >

Definition at line 15 of file chaman.cc.


Member Typedef Documentation

template<typename T>
typedef const T* SimpleArray< T >::const_iterator

Definition at line 75 of file mergetest.cc.

template<typename T>
typedef const T* SimpleArray< T >::const_iterator

Definition at line 86 of file testgeom.cc.

template<typename T>
typedef T* SimpleArray< T >::iterator

Definition at line 74 of file mergetest.cc.

template<typename T>
typedef T* SimpleArray< T >::iterator

Definition at line 85 of file testgeom.cc.


Constructor & Destructor Documentation

template<typename T>
SimpleArray< T >::SimpleArray ( ) [inline]

Definition at line 22 of file chaman.cc.

: array(NULL), array_alloc(0), array_size(0){}
template<typename T>
SimpleArray< T >::~SimpleArray ( ) [inline]

Definition at line 23 of file chaman.cc.

{reset();}
template<typename T>
SimpleArray< T >::SimpleArray ( ) [inline]

Definition at line 55 of file mergetest.cc.

: arr(0) , arrSize(0), arrAllocated(0) {}
template<typename T>
SimpleArray< T >::SimpleArray ( unsigned  s) [inline]

Definition at line 56 of file mergetest.cc.

                              :arrSize(s), arrAllocated(s) {
      arr = (T*)malloc(s*sizeof(T));
      for (unsigned i = 0; i < s; ++i)
        new (arr+i) T();
    }
template<typename T>
SimpleArray< T >::~SimpleArray ( ) [inline]

Definition at line 62 of file mergetest.cc.

                   {
      for (int i = 0; i < size(); ++i)
        arr[i].~T();
      free(arr);
    }
template<typename T>
SimpleArray< T >::SimpleArray ( ) [inline]

Definition at line 66 of file testgeom.cc.

: arr(0) , arrSize(0), arrAllocated(0) {}
template<typename T>
SimpleArray< T >::SimpleArray ( unsigned  s) [inline]

Definition at line 67 of file testgeom.cc.

                              :arrSize(s), arrAllocated(s) {
      arr = (T*)malloc(s*sizeof(T));
      for (unsigned i = 0; i < s; ++i)
        new (arr+i) T();
    }
template<typename T>
SimpleArray< T >::~SimpleArray ( ) [inline]

Definition at line 73 of file testgeom.cc.

                   {
      for (int i = 0; i < size(); ++i)
        arr[i].~T();
      free(arr);
    }

Member Function Documentation

template<typename T>
iterator SimpleArray< T >::begin ( ) [inline]

Definition at line 76 of file mergetest.cc.

{ return arr; }
template<typename T>
const_iterator SimpleArray< T >::begin ( ) const [inline]

Definition at line 77 of file mergetest.cc.

{ return arr; }
template<typename T>
iterator SimpleArray< T >::begin ( ) [inline]

Definition at line 87 of file testgeom.cc.

{ return arr; }
template<typename T>
const_iterator SimpleArray< T >::begin ( ) const [inline]

Definition at line 88 of file testgeom.cc.

{ return arr; }
template<typename T>
int& SimpleArray< T >::capacity ( ) [inline]

Definition at line 71 of file mergetest.cc.

{ return arrAllocated; }
template<typename T>
int SimpleArray< T >::capacity ( ) const [inline]

Definition at line 72 of file mergetest.cc.

{ return arrAllocated; }
template<typename T>
int& SimpleArray< T >::capacity ( ) [inline]

Definition at line 82 of file testgeom.cc.

{ return arrAllocated; }
template<typename T>
int SimpleArray< T >::capacity ( ) const [inline]

Definition at line 83 of file testgeom.cc.

{ return arrAllocated; }
template<typename T>
iterator SimpleArray< T >::end ( ) [inline]

Definition at line 78 of file mergetest.cc.

{ return arr + arrSize; }
template<typename T>
const_iterator SimpleArray< T >::end ( ) const [inline]

Definition at line 79 of file mergetest.cc.

{ return arr + arrSize; }
template<typename T>
iterator SimpleArray< T >::end ( ) [inline]

Definition at line 89 of file testgeom.cc.

{ return arr + arrSize; }
template<typename T>
const_iterator SimpleArray< T >::end ( ) const [inline]

Definition at line 90 of file testgeom.cc.

{ return arr + arrSize; }
template<typename T>
T SimpleArray< T >::operator[] ( unsigned int  lhs) [inline]

Definition at line 25 of file chaman.cc.

{return array[lhs];}
template<typename T>
T& SimpleArray< T >::operator[] ( unsigned  idx) [inline]

Definition at line 82 of file mergetest.cc.

{ return arr[idx]; }
template<typename T>
T SimpleArray< T >::operator[] ( unsigned  idx) const [inline]

Definition at line 83 of file mergetest.cc.

{ return arr[idx]; }
template<typename T>
T& SimpleArray< T >::operator[] ( unsigned  idx) [inline]

Definition at line 93 of file testgeom.cc.

{ return arr[idx]; }
template<typename T>
T SimpleArray< T >::operator[] ( unsigned  idx) const [inline]

Definition at line 94 of file testgeom.cc.

{ return arr[idx]; }
template<typename T>
T** SimpleArray< T >::ptr ( ) [inline]

Definition at line 68 of file mergetest.cc.

{ return &arr; }
template<typename T>
T** SimpleArray< T >::ptr ( ) [inline]

Definition at line 79 of file testgeom.cc.

{ return &arr; }
template<typename T>
void SimpleArray< T >::reset ( ) [inline]

Definition at line 27 of file chaman.cc.

               {
    if (0 != array) {
      free(array); array = NULL; array_alloc = array_size = 0;
    }
  }
template<typename T>
int SimpleArray< T >::size ( ) [inline]

Definition at line 32 of file chaman.cc.

{return array_size;}
template<typename T>
int& SimpleArray< T >::size ( ) [inline]

Definition at line 69 of file mergetest.cc.

{ return arrSize; }
template<typename T>
int SimpleArray< T >::size ( ) const [inline]

Definition at line 70 of file mergetest.cc.

{ return arrSize; }
template<typename T>
int& SimpleArray< T >::size ( ) [inline]

Definition at line 80 of file testgeom.cc.

{ return arrSize; }
template<typename T>
int SimpleArray< T >::size ( ) const [inline]

Definition at line 81 of file testgeom.cc.

{ return arrSize; }

Member Data Documentation

template<typename T>
T * SimpleArray< T >::arr [private]

Definition at line 50 of file mergetest.cc.

template<typename T>
int SimpleArray< T >::arrAllocated [private]

Definition at line 52 of file mergetest.cc.

template<typename T>
T* SimpleArray< T >::array

Definition at line 18 of file chaman.cc.

template<typename T>
int SimpleArray< T >::array_alloc

Definition at line 19 of file chaman.cc.

template<typename T>
int SimpleArray< T >::array_size

Definition at line 20 of file chaman.cc.

template<typename T>
int SimpleArray< T >::arrSize [private]

Definition at line 51 of file mergetest.cc.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines