#ifndef MEMORY_POOL_CLASS
#define MEMORY_POOL_CLASS

/*****************************************************************************\
*                                                                             *
*  Name   : memory_pool                                                       *
*  Author : Chris Koeritz                                                     *
*                                                                             *
*  Purpose:                                                                   *
*                                                                             *
*    Provides allocation and deallocation of heap memory for C++.  This class *
*  delays deallocation as a way to speed up future allocations.  It is used   *
*  as a replacement for the standard new and delete operations.  No object    *
*  should really need to deal with this object directly.                      *
*                                                                             *
*******************************************************************************
* Copyright (c) 1998-$now By Author.  This program is free software; you can  *
* redistribute it and/or modify it under the terms of the GNU General Public  *
* License as published by the Free Software Foundation; either version 2 of   *
* the License or (at your option) any later version.  This is online at:      *
*     http://www.fsf.org/copyleft/gpl.html                                    *
* Please send any updates to: fred@gruntose.com                               *
\*****************************************************************************/

#ifndef OMIT_MEMORY_POOL

#include <ctype.h>

// forward.
class ubb_zone_matcher;

class memory_pool
{
public:
  void construct();  // faux constructor for mallocing.
  void destruct();  // faux destructor, call before free.
  void *provide_memory(size_t size);
    // returns a chunk of memory with the "size" specified.
  void stow_memory(void *ptr);
    // hangs onto a chunk of memory in "ptr" if limits have not been reached.
    // otherwise "ptr" is freed.
  void flush_all();  // drops all held memory--poignant.

  istring text_form();  // returns a string with the stats for this object.

private:
  ubb_zone_matcher *_matcher;  // internal object manages all allocations.
};

#endif // omit memory pool.

#endif // outer guard.

