/****************************************************************************
* grecordpool.h :
* header file for record-cache classes.
*
* Change Log :
* Oct 28, 1998 Initial version, Liujian Qian
*
* $Id$
***************************************************************************/
#ifndef _RECPOOL_H_
#define _RECPOOL_H_
template<class REC>
class GRecordPool
{
const int POOL_DELTA = 400;
static int n_total;
static int n_free;
static REC* pool;
public:
///
// allocate an entry record from the pool
static REC* allocEntry();
///
// free an entry record and put it back to the pool
static void freeEntry(REC* ep);
///
// extend the capacity of the pool w/ 'incr' of new episodes
static Result extendPool(int incr=POOL_DELTA);
///
// free all entry; vacate the pool
static void freeAll();
static void stats (){
cout<<"total records allocated: "
<<n_total<<", free records: "
<<n_free<<endl;
}
};
#endif
Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999