summaryrefslogtreecommitdiff
path: root/common/array.h
blob: c8ce59c4076f725533fde6b5208a3585ef87dce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef _ARRAY_H_
#define _ARRAY_H_

template <class T>
class PtrArray
{
 public:
  PtrArray (int nSize = 0);
  ~PtrArray ();

  void SetSize (int nSize);
  int GetSize () const
    { return m_nLength; }

  T* RemoveIndex (int nIndex);
  T* RemovePointer (T* pObj);
  void Add (T* pObj);

  T* operator [](int nIndex) const
    { return m_pData[nIndex]; }

 protected:
  void Expand (int nGrow);

  T** m_pData;
  int m_nLength;
  int m_nAlloc;
};

#include "array.cpp"

#endif // _ARRAY_H_