CoCoALib-0.9905 date: 23 May 2007


GMPAllocator.H

Go to the documentation of this file.
00001 #ifndef CoCoA_GMPAllocator_H
00002 #define CoCoA_GMPAllocator_H
00003 
00004 //   Copyright (c)  2005,2006  John Abbott
00005 
00006 //   This file is part of the source of CoCoALib, the CoCoA Library.
00007 
00008 //   CoCoALib is free software; you can redistribute it and/or modify
00009 //   it under the terms of the GNU General Public License (version 2)
00010 //   as published by the Free Software Foundation.  A copy of the full
00011 //   licence may be found in the file COPYING in this directory.
00012 
00013 //   CoCoALib is distributed in the hope that it will be useful,
00014 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //   GNU General Public License for more details.
00017 
00018 //   You should have received a copy of the GNU General Public License
00019 //   along with CoCoA; if not, write to the Free Software
00020 //   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 
00023 #include "CoCoA/MemPool.H"
00024 
00025 #include <stddef.h>
00026 
00027 extern "C"
00028 {
00029   void* CoCoA_GMP_alloc(size_t sz);
00030   void* CoCoA_GMP_realloc(void* ptr, size_t oldsz, size_t newsz);
00031   void CoCoA_GMP_free(void* ptr, size_t sz);
00032 }
00033 
00034 namespace CoCoA
00035 {
00036 
00037   class GMPAllocator
00038   {
00039   public:
00040     explicit GMPAllocator(size_t SliceSize=16); // default slice size is 16 bytes
00041     ~GMPAllocator();
00042   private: // disable copy ctor and assignment
00043     GMPAllocator(const GMPAllocator&);           // NEVER DEFINED -- disable default copy ctor
00044     GMPAllocator& operator=(const GMPAllocator&);// NEVER DEFINED -- disable assignment
00045   private:
00046     mutable MemPool myMemPool;
00047   };
00048 
00049 } // end of namespace CoCoA
00050 
00051 
00052 // RCS header/log in the next few lines
00053 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/GMPAllocator.H,v 1.1.1.1 2007/03/09 15:16:11 abbott Exp $
00054 // $Log: GMPAllocator.H,v $
00055 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00056 // Imported files
00057 //
00058 // Revision 1.5  2006/12/06 17:11:16  cocoa
00059 // -- removed #include "config.H"
00060 //
00061 // Revision 1.4  2006/10/06 14:04:16  cocoa
00062 // Corrected position of #ifndef in header files.
00063 // Separated CoCoA_ASSERT into assert.H from config.H;
00064 // many minor consequential changes (have to #include assert.H).
00065 // A little tidying of #include directives (esp. in Max's code).
00066 //
00067 // Revision 1.3  2006/10/06 10:08:17  cocoa
00068 // Added changelog.
00069 //
00070 
00071 
00072 #endif

Generated on Wed May 23 13:43:34 2007 for CoCoALib by  doxygen 1.4.6