00001 /* 00002 * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software 00003 * 00004 * The Software has been developped within the Siames Project. 00005 * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights 00006 * 00007 * The Software has been registered with the Agence pour la Protection des 00008 * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200 00009 * 00010 * This file may be distributed under the terms of the Q Public License 00011 * version 1.0 as defined by Trolltech AS of Norway and appearing in the file 00012 * LICENSE.QPL included in the packaging of this file. 00013 * 00014 * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 00015 * for the software may use this file in accordance with that specific license 00016 * 00017 */ 00018 #ifndef PsnAbstractArrayHEADER 00019 #define PsnAbstractArrayHEADER 00020 00021 #include <PsnNew.h> 00022 #include <typeinfo> 00023 00025 template <typename T> 00026 class PsnAbstractArray { 00027 public: 00028 PsnAbstractArray (size_t taille) {}; 00029 virtual ~PsnAbstractArray () {} ; 00030 virtual T & operator [] ( int i ) = 0 ; 00031 virtual const T & operator [] ( int i ) const = 0 ; 00032 virtual void printDebuggingInformation(unsigned int numberToShow) ; 00033 }; 00034 00035 template <typename T> 00036 void PsnAbstractArray< T >::printDebuggingInformation (unsigned int numberToShow) { 00037 unsigned int i; 00038 cerr <<" PsnAbstractArray<"<<typeid(T).name()<<">::printDebuggingInformation ("<<numberToShow<<")"<<endl<<"\t"; 00039 for (i = 0 ; i < numberToShow ; i++) { 00040 cerr << &( (*this) [i]) << " \t" ; 00041 } 00042 cerr << endl << "\t" ; 00043 for (i = 0 ; i < numberToShow ; i++) { 00044 cerr << (*this)[i].valeur << " "<< (*this)[i].dateValeur<< " \t" ; 00045 } 00046 cerr << endl; 00047 } 00048 00051 template <typename T> 00052 class PsnArray : public PsnAbstractArray< T > { 00053 public : 00054 PsnArray ( size_t taille ); 00055 virtual ~PsnArray () ; 00056 virtual T & operator [] ( int i ) ; 00057 virtual const T & operator [] ( int i ) const ; 00058 protected : 00059 T * tab; 00060 }; 00061 00062 template <typename T> 00063 PsnArray<T>::PsnArray( size_t taille ) : PsnAbstractArray<T>(taille) { 00064 //cerr<<"Creation of PsnArray ŕ "; 00065 tab = new T [ taille ] ; 00066 //cerr<<(void *) tab<<endl; 00067 } 00068 00069 template <typename T> 00070 PsnArray<T>::~PsnArray( ) { 00071 //cerr<<"Destruction d'un PsnArray ŕ "<<(void *) tab<<endl;; 00072 delete [] tab ; 00073 } 00074 00075 template <typename T> 00076 T & PsnArray<T>::operator [] (int i) { 00077 return tab [i] ; 00078 } 00079 00080 template <typename T> 00081 const T & PsnArray<T>::operator [] (int i) const { 00082 return tab [i] ; 00083 } 00084 00085 #if defined(_MOME) || !defined(_SGI) 00086 #include <PsnMomeArray.h> 00087 #endif 00088 00089 #endif 00090 00091
| Documentation generated on Mon Nov 25 15:25:00 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |