Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

PtrArray.h

Go to the documentation of this file.
00001 /*
00002     File:       PtrArray.h
00003 
00004     Function:   
00005 
00006     Author:     Andrew Willmott
00007 
00008     Copyright:  (c) 1998-2000, Andrew Willmott
00009 */
00010 
00011 #ifndef __PtrArray__
00012 #define __PtrArray__
00013 
00014 #include "cl/Array.h"
00015 
00016 typedef Array<Void*> VoidPtrArray;
00017 
00018 template<class T> class PtrArray : public VoidPtrArray
00019 {
00020 public:
00021     inline T*&      operator [] (Int i)
00022                     { return((T*&) item[i]); };     // indexing operator
00023     inline T*       operator [] (Int i) const
00024                     { return((T*) item[i]); };      // indexing operator
00025 
00026     T*              &Item(Int i)
00027                      { return((T*&) item[i]); };
00028     T*              Item(Int i) const
00029                     { return((T*) item[i]); };
00030     T*              &Last()
00031                     { return((T*&) VoidPtrArray::Last()); };
00032 
00033     Void            Append(T* t)
00034                     { VoidPtrArray::Append((Void*) t); };
00035 
00036     inline Void     FreeAll();
00037 };
00038 
00039 template<class T> inline Void PtrArray<T>::FreeAll()
00040 {
00041     Int     i;
00042 
00043     for (i = 0; i < items; i++)
00044         delete ((T*) item[i]);
00045 }
00046 
00047 #endif

Generated at Sat Aug 5 00:16:33 2000 for Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000