| 1 | // -*- C++ -*- |
| 2 | |
| 3 | /* |
| 4 | |
| 5 | Heap Layers: An Extensible Memory Allocation Infrastructure |
| 6 | |
| 7 | Copyright (C) 2000-2020 by Emery Berger |
| 8 | http://www.emeryberger.com |
| 9 | [email protected] |
| 10 | |
| 11 | Heap Layers is distributed under the terms of the Apache 2.0 license. |
| 12 | |
| 13 | You may obtain a copy of the License at |
| 14 | http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | |
| 16 | */ |
| 17 | |
| 18 | #ifndef HL_NULLHEAP_H |
| 19 | #define HL_NULLHEAP_H |
| 20 | |
| 21 | #include <assert.h> |
| 22 | |
| 23 | /** |
| 24 | * @class NullHeap |
| 25 | * @brief A source heap that does nothing. |
| 26 | */ |
| 27 | |
| 28 | namespace HL { |
| 29 | |
| 30 | template <class SuperHeap> |
| 31 | class NullHeap : public SuperHeap { |
| 32 | public: |
| 33 | enum { Alignment = 0 }; |
| 34 | inline void * malloc (size_t) const { return 0; } |
| 35 | inline void * memalign(size_t, size_t) const { return 0; } |
| 36 | inline void free (void *) const {} |
| 37 | inline int remove (void *) const { return 0; } |
| 38 | inline void clear (void) const {} |
| 39 | inline size_t getSize (void *) const { return 0; } |
| 40 | }; |
| 41 | |
| 42 | } |
| 43 | |
| 44 | #endif |