Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: utility/mempool.h
- Revision:
- 2:049ce85163c5
- Parent:
- 1:01c2344f98a3
- Child:
- 3:5b17e4656dd0
--- a/utility/mempool.h Thu Nov 20 21:26:54 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- mempool.h - sleek implementation of a memory pool
- Copyright (c) 2013 Norbert Truchsess <norbert.truchsess@t-online.de>
- All rights reserved.
-
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef MEMPOOL_H
- #define MEMPOOL_H
-
- #include <inttypes.h>
-
- #define POOLSTART 0
- #define NOBLOCK 0
-
- #include "mempool_conf.h"
-
-//#ifdef MEMBLOCK_MV
-
-//#define memblock_mv_cb(dest,src,size) MEMBLOCK_MV(dest,src,size)
-//#endif
- #ifdef MEMBLOCK_ALLOC
- #define memblock_alloc_cb(address, size) MEMBLOCK_ALLOC(address, size)
- #endif
- #ifdef MEMBLOCK_FREE
- #define memblock_free_cb(address, size) MEMBLOCK_FREE(address, size)
- #endif
-struct memblock
-{
- memaddress begin;
- memaddress size;
- memhandle nextblock;
-};
-
-class MemoryPool
-{
- #ifdef MEMPOOLTEST_H
- friend class MemoryPoolTest;
- #endif
-protected:
- memaddress poolsize;
- struct memblock blocks[NUM_MEMBLOCKS + 1];
- #ifdef MEMBLOCK_MV
- virtual void memblock_mv_cb(memaddress dest, memaddress src, memaddress size) = 0;
- #endif
-public:
- MemoryPool(memaddress start, memaddress size);
- memhandle allocBlock(memaddress);
- void freeBlock(memhandle);
- void resizeBlock(memhandle handle, memaddress position);
- void resizeBlock(memhandle handle, memaddress position, memaddress size);
- memaddress blockSize(memhandle);
-};
-#endif