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.
MemPool.h
00001 /* 00002 mempool.h - sleek implementation of a memory pool 00003 Copyright (c) 2013 Norbert Truchsess <norbert.truchsess@t-online.de> 00004 All rights reserved. 00005 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 #ifndef MEMPOOL_H 00020 #define MEMPOOL_H 00021 00022 #include <inttypes.h> 00023 00024 #define POOLSTART 0 00025 #define NOBLOCK 0 00026 00027 #include "mempool_conf.h" 00028 00029 struct memblock 00030 { 00031 memaddress begin; 00032 memaddress size; 00033 memhandle nextblock; 00034 }; 00035 00036 class MemPool 00037 { 00038 #ifdef MEMPOOLTEST_H 00039 friend class MemoryPoolTest; 00040 #endif 00041 protected: 00042 static struct memblock blocks[MEMPOOL_NUM_MEMBLOCKS + 1]; 00043 public: 00044 00045 void init(); 00046 static memhandle allocBlock(memaddress); 00047 static void freeBlock(memhandle); 00048 static void resizeBlock(memhandle handle, memaddress position); 00049 static void resizeBlock(memhandle handle, memaddress position, memaddress size); 00050 static memaddress blockSize(memhandle); 00051 }; 00052 #endif
Generated on Sun Feb 26 2023 10:14:23 by
1.7.2