Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

gpobjbuffer.hpp

Go to the documentation of this file.
00001 //************************************************************************************//
00002 // Module       : gpobjbuffer.hpp
00003 // Date         : 7/9/01 (DLR)
00004 // Copyright    : 2001-2006 Copyright University Corporation for Atmospheric
00005 //                Research
00006 // Description  : Encapsulates the methods and data associated with
00007 //                a buffer template object holding GASpAR object pointers
00008 // Derived From : none.
00009 // Modifications:
00010 //************************************************************************************//
00011 #if !defined(GPOBJBUFFER_HPP)
00012 #define GPOBJBUFFER_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(pGLLBuffer)
00022 #  define pGLLBuffer  GpObjBuffer<GLLBasis>
00023 #endif
00024 
00025 #if !defined(pGLBuffer)
00026 #  define pGLBuffer  GpObjBuffer<GLBasis>
00027 #endif
00028 
00029 
00030 template<class TBUFF> class GpObjBuffer
00031 {
00032 
00033 
00034 private:
00035 
00036 // Private methods:
00037         void              DeleteDynamic();
00038 
00039 // Private data:
00040         GINT               n;
00041         TBUFF             **data;
00042 
00043 
00044 public:
00045                            GpObjBuffer();
00046                            GpObjBuffer(GINT  size);
00047                            GpObjBuffer(const GpObjBuffer &);
00048 //virtual                 ~GpObjBuffer();
00049                           ~GpObjBuffer();
00050 
00051 
00052          void              operator=(GpObjBuffer<TBUFF> &);
00053          void              operator=(TBUFF *m);
00054 inline    TBUFF            *&operator()(const GINT  i) { 
00055                             if ( i >= n || i < 0 ) {
00056                               cout << "GpObjBuffer<T>::(): access error: index=" << i << "; max=" <<  n << endl;
00057                               exit(1);
00058                              }
00059                             return data[i]; }
00060 inline    TBUFF            *&operator[](const GINT  i) const {
00061                             if ( i >= n || i < 0 ) {
00062                               cout << "GpObjBuffer<T>::[]: access error: index=" << i << "; max=" <<  n << endl;
00063                               exit(1);
00064                              }
00065                             return data[i]; } 
00066 #if 0
00067          friend ostream&   operator<<(ostream &, const GpObjBuffer<TBUFF> &);
00068 #else
00069          friend ostream&   operator<<(ostream &, GpObjBuffer<GLLBasis> &);
00070          friend ostream&   operator<<(ostream &, GpObjBuffer<GLBasis>  &);
00071 //       friend ostream&   operator<<(ostream &, GpObjBuffer<void>  &);
00072 #endif
00073                    
00074          GINT              dim() const;
00075          TBUFF           **Data();
00076          GBOOL             Resize(GINT  order);
00077          GBOOL             contains(TBUFF *imember, GINT  &index);
00078          GBOOL             contains(TBUFF *imember, GINT  istart, GINT  num, GINT  &index);
00079          void              GetSection(GpObjBuffer<TBUFF> &section, GINT  *ilist, GINT  nlist);
00080          GpObjBuffer<TBUFF> &GetSection(GINT  *ilist, GINT  nlist);
00081 
00082 
00083 };
00084 #if defined(_LINUX) || defined(_AIX)
00085 template class GpObjBuffer<GLLBasis>;
00086 ostream &operator <<(ostream&, const GpObjBuffer<GLLBasis>&);
00087 template class GpObjBuffer<GLBasis>;
00088 ostream &operator <<(ostream&, const GpObjBuffer<GLBasis>&);
00089 //template class GpObjBuffer<void>;
00090 //ostream &operator <<(ostream&, const GpObjBuffer<void>&);
00091 #endif
00092 #endif

Generated on Wed Dec 21 16:00:48 2005 for Geophysics & Astrophysics Spectral Element Adaptive Refinement (GASpAR) 2D Code by  doxygen 1.4.4