paul@93 | 1 | /* |
paul@93 | 2 | * A generic memory pool abstraction. |
paul@93 | 3 | * |
paul@93 | 4 | * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk> |
paul@93 | 5 | * |
paul@93 | 6 | * This program is free software; you can redistribute it and/or |
paul@93 | 7 | * modify it under the terms of the GNU General Public License as |
paul@93 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@93 | 9 | * the License, or (at your option) any later version. |
paul@93 | 10 | * |
paul@93 | 11 | * This program is distributed in the hope that it will be useful, |
paul@93 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@93 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@93 | 14 | * GNU General Public License for more details. |
paul@93 | 15 | * |
paul@93 | 16 | * You should have received a copy of the GNU General Public License |
paul@93 | 17 | * along with this program; if not, write to the Free Software |
paul@93 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@93 | 19 | * Boston, MA 02110-1301, USA |
paul@93 | 20 | */ |
paul@93 | 21 | |
paul@1 | 22 | #pragma once |
paul@1 | 23 | |
paul@94 | 24 | #include <mem/region.h> |
paul@1 | 25 | |
paul@1 | 26 | |
paul@1 | 27 | |
paul@72 | 28 | /* A memory pool interface. */ |
paul@1 | 29 | |
paul@1 | 30 | class Memory |
paul@1 | 31 | { |
paul@72 | 32 | public: |
paul@72 | 33 | virtual ~Memory() |
paul@72 | 34 | { |
paul@72 | 35 | } |
paul@63 | 36 | |
paul@72 | 37 | virtual Region *region() = 0; |
paul@1 | 38 | |
paul@72 | 39 | virtual offset_t region_size() = 0; |
paul@14 | 40 | |
paul@72 | 41 | virtual void release(Region *region) = 0; |
paul@1 | 42 | }; |
paul@1 | 43 | |
paul@1 | 44 | // vim: tabstop=4 expandtab shiftwidth=4 |