00001
00039 #ifndef ABA_STANDARDPOOL_H
00040 #define ABA_STANDARDPOOL_H
00041
00042 #include "abacus/list.h"
00043 #include "abacus/pool.h"
00044
00045 #ifdef ABACUS_PARALLEL
00046 class ABA_MESSAGE;
00047 #endif
00048
00049 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX
00050 template<class BaseType, class CoType>
00051 class ABA_STANDARDPOOL;
00052
00053 template<class BaseType, class CoType>
00054 ostream& operator<< (ostream &out, const ABA_STANDARDPOOL<BaseType,CoType> &rhs);
00055 #endif
00056
00057 template<class BaseType, class CoType>
00058 class ABA_STANDARDPOOL:public ABA_POOL<BaseType,CoType> {
00059 public:
00060
00072 ABA_STANDARDPOOL(ABA_MASTER*master,int size,bool autoRealloc= false);
00073
00078 virtual~ABA_STANDARDPOOL();
00079 #ifdef ABACUS_PARALLEL
00080
00087 ABA_STANDARDPOOL(const ABA_MASTER*master,ABA_MESSAGE&msg);
00088
00093 void pack(ABA_MESSAGE&msg)const;
00094 #endif
00095 #ifdef ABACUS_NEW_TEMPLATE_SYNTAX
00096
00105 friend ostream& operator<< <> (ostream &,const ABA_STANDARDPOOL &);
00106 #else
00107
00116 friend ostream& operator<<(ostream& out,const ABA_STANDARDPOOL& rhs);
00117 #endif
00118
00119
00133 virtual ABA_POOLSLOT<BaseType,CoType> *insert(BaseType*cv);
00134
00142 virtual void increase(int size);
00143
00150 int cleanup();
00151
00155 int size()const;
00156
00161 ABA_POOLSLOT<BaseType,CoType> *slot(int i);
00162
00201 virtual int separate(double*x,
00202 ABA_ACTIVE<CoType,BaseType> *active,
00203 ABA_SUB*sub,
00204 ABA_CUTBUFFER<BaseType,CoType> *cutBuffer,
00205 double minAbsViolation= 0.001,
00206 int ranking= 0);
00207 protected:
00208
00209
00215 int removeNonActive(int maxRemove);
00216
00223 virtual ABA_POOLSLOT<BaseType,CoType> *getSlot();
00224
00231 virtual void putSlot(ABA_POOLSLOT<BaseType,CoType> *slot);
00232
00235 ABA_ARRAY<ABA_POOLSLOT<BaseType,CoType> *> pool_;
00236
00239 ABA_LIST<ABA_POOLSLOT<BaseType,CoType> *> freeSlots_;
00240
00245 bool autoRealloc_;
00246
00247
00248 private:
00249 ABA_STANDARDPOOL(const ABA_STANDARDPOOL&rhs);
00250 const ABA_STANDARDPOOL&operator= (const ABA_STANDARDPOOL&rhs);
00251 };
00252
00253
00254
00255 #include "abacus/standardpool.inc"
00256
00257 #endif // ABA_STANDARDPOOL_H
00258