buffer.h

Go to the documentation of this file.
00001 
00041 #ifndef ABA_BUFFER_H
00042 #define ABA_BUFFER_H
00043 #include <stdlib.h>
00044 #include <iostream>
00045 using namespace std;
00046 
00047 #include "abacus/global.h"
00048 
00049 #ifdef ABACUS_PARALLEL
00050 class ABA_MESSAGE;
00051 #endif
00052 
00053 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX
00054 template<class Type>
00055 class  ABA_BUFFER;
00056  
00057 template<class Type> 
00058 ostream& operator<< (ostream& out, const ABA_BUFFER<Type> &buffer);
00059 #endif
00060 
00061   template <class Type> class  ABA_BUFFER :  public ABA_ABACUSROOT  {
00062     public:
00063 
00069       ABA_BUFFER(ABA_GLOBAL *glob, int size);
00070 
00075       ABA_BUFFER(const ABA_BUFFER<Type> &rhs);
00076 
00078       ~ABA_BUFFER();
00079 #ifdef ABACUS_PARALLEL
00080 
00086       ABA_BUFFER(const ABA_GLOBAL *glob, ABA_MESSAGE &msg);
00087 
00092       void pack(ABA_MESSAGE &msg) const;
00093 #endif
00094 
00101       const ABA_BUFFER<Type>& operator=(const ABA_BUFFER<Type>& rhs);
00102 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX
00103 
00113       friend ostream& operator<< <> (ostream& , const ABA_BUFFER<Type> &);
00114 #else
00115 
00125       friend ostream& operator<< (ostream& out, const ABA_BUFFER<Type> &buffer);
00126 #endif
00127 
00138       Type& operator[](int i);
00139 
00142       const Type& operator[](int i) const;
00143 
00146       int size() const;
00147 
00150       int number() const;
00151 
00155       bool full() const;
00156 
00160       bool empty() const;
00161 
00171       void push(Type item);
00172 
00183       Type pop();
00184 
00187       void clear();
00188 
00204       void leftShift(ABA_BUFFER<int> &ind);
00205 
00213       void realloc (int newSize);
00214 
00215     private:
00216 
00219       ABA_GLOBAL *glob_;
00220 
00223       int         size_;
00224 
00227       int         n_;
00228 
00231       Type       *buf_;
00232   };
00233 
00234 #include "abacus/buffer.inc"
00235 
00236 #endif  // ABA_BUFFER_H
00237 
00238 

Generated on Tue Aug 14 18:09:53 2007 for ABACUS by  doxygen 1.5.1