00001 00040 #ifndef ABA_ACTIVE_H 00041 #define ABA_ACTIVE_H 00042 #include "abacus/array.h" 00043 00044 class ABA_MASTER; 00045 class ABA_SPARVEC; 00046 #ifdef ABACUS_PARALLEL 00047 class ABA_MESSAGE; 00048 #endif 00049 00050 template<class BaseType, class CoType> class ABA_POOLSLOT; 00051 template<class BaseType, class CoType> class ABA_POOLSLOTREF; 00052 00053 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX 00054 template<class BaseType,class CoType> 00055 class ABA_ACTIVE; 00056 00057 template<class BaseType,class CoType> 00058 ostream&operator<< (ostream &out, const ABA_ACTIVE<BaseType, CoType> &rhs); 00059 #endif 00060 00061 template <class BaseType, class CoType> 00062 class ABA_ACTIVE : public ABA_ABACUSROOT { 00063 public: 00064 00070 ABA_ACTIVE(ABA_MASTER *master, int max); 00071 00080 ABA_ACTIVE(ABA_MASTER *master, ABA_ACTIVE *a, int max); 00081 00086 ABA_ACTIVE(const ABA_ACTIVE<BaseType, CoType> &rhs); 00087 00089 ~ABA_ACTIVE(); 00090 #ifdef ABACUS_PARALLEL 00091 00115 ABA_ACTIVE(const ABA_MASTER *master, ABA_MESSAGE &msg, 00116 ABA_BUFFER<ABA_ID> **idBuffer, ABA_BUFFER<int> **needed); 00117 00134 void unpackNeeded(ABA_MESSAGE &msg, const ABA_BUFFER<ABA_ID> &idBuffer, 00135 const ABA_BUFFER<int> &needed); 00136 00142 void pack(ABA_MESSAGE &msg) const; 00143 00151 void packNeeded(ABA_MESSAGE &msg, const ABA_BUFFER<int> &needed) const; 00152 #endif 00153 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX 00154 00167 friend ostream &operator<< <> (ostream &, 00168 const ABA_ACTIVE<BaseType, CoType> &); 00169 #else 00170 00181 friend ostream &operator<< (ostream &out, 00182 const ABA_ACTIVE<BaseType, CoType> &rhs); 00183 #endif 00184 00187 int number() const; 00188 00191 int max() const; 00192 00200 BaseType* operator[](int i); 00201 00206 ABA_POOLSLOTREF<BaseType, CoType>* poolSlotRef(int i); 00207 00212 void insert(ABA_POOLSLOT<BaseType, CoType> *ps); 00213 00220 void insert(ABA_BUFFER<ABA_POOLSLOT<BaseType, CoType> *> &ps); 00221 00227 void remove(ABA_BUFFER<int> &del); 00228 00234 void realloc(int newSize); 00235 00238 int redundantAge(int i) const; 00239 00245 void incrementRedundantAge(int i); 00246 00251 void resetRedundantAge(int i); 00252 00253 private: 00256 ABA_MASTER *master_; 00259 int n_; 00260 00263 ABA_ARRAY<ABA_POOLSLOTREF<BaseType, CoType> *> active_; 00264 00267 ABA_ARRAY<int> redundantAge_; 00268 const ABA_ACTIVE<BaseType, CoType> 00269 &operator=(const ABA_ACTIVE<BaseType, CoType> & rhs); 00270 }; 00271 00272 00273 #include "abacus/active.inc" 00274 00275 #endif // ABA_ACTIVE_H 00276