00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #if !defined(GOBJBUFFER_HPP)
00012 #define GOBJBUFFER_HPP
00013
00014 #include "gtypes.h"
00015 #include <iostream.h>
00016 #include <stdlib.h>
00017 #include "gllbasis.hpp"
00018 #include "glbasis.hpp"
00019
00020
00021 #if !defined(CHBuffer)
00022 # define CHBuffer GObjBuffer<CHandle>
00023 #endif
00024
00025
00026 template<class TBUFF> class GObjBuffer
00027 {
00028
00029
00030 private:
00031
00032
00033 void DeleteDynamic();
00034
00035
00036 GINT n;
00037 TBUFF *data;
00038
00039
00040 public:
00041 GObjBuffer();
00042 GObjBuffer(GINT size);
00043 GObjBuffer(const GObjBuffer &);
00044
00045 ~GObjBuffer();
00046
00047
00048 #if 0
00049 void operator=(GObjBuffer<TBUFF> &);
00050 void operator=(TBUFF *m);
00051 #endif
00052 inline TBUFF &operator()(const GINT i) {
00053 #if defined(GARRAY_BOUNDS)
00054 if ( i >= n || i < 0 ) {
00055 cout << "GObjBuffer<T>::(): access error: index=" << i << "; max=" << n << endl;
00056 exit(1);
00057 }
00058 #endif
00059 return data[i]; }
00060 inline TBUFF &operator[](const GINT i) const {
00061 #if defined(GARRAY_BOUNDS)
00062 if ( i >= n || i < 0 ) {
00063 cout << "GObjBuffer<T>::[]: access error: index=" << i << "; max=" << n << endl;
00064 exit(1);
00065 }
00066 #endif
00067 return data[i]; }
00068 #if 0
00069 friend ostream& operator<<(ostream &, const GObjBuffer<TBUFF> &);
00070 #endif
00071
00072 GINT dim() const;
00073 TBUFF *Data();
00074 GBOOL Resize(GINT order);
00075
00076 };
00077 #if defined(_LINUX) || defined(_AIX)
00078 template class GObjBuffer<CHandle>;
00079 ostream &operator <<(ostream&, const GObjBuffer<CHandle>&);
00080 #endif
00081 #endif