NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
eggDisposer.h
1#pragma once
2
3#include <lib/nw4r/ut/list.h>
4
5namespace EGG {
6
7class Heap;
8
9/**
10 * @brief Interface for a garbage collector.
11 * @details When a heap is destroyed, its managing memory is implicitly freed.
12 * However, the destructors of objects are never explicitly called when this happens.
13 * To solve this, heaps have a linked list for classes that can opt-in for explicit destruction.
14 *
15 * To opt a class in for memory management, privately inherit this class.
16 * @ingroup eggcore
17 */
18class Disposer {
19public:
20 /// @brief Registers the disposer in the containing heap.
21 Disposer();
22
23 /// @brief Unregisters the disposer in the containing heap.
24 virtual ~Disposer();
25
26private:
27 Heap *mHeap; ///< Heap in which the disposer is allocated, or NULL otherwise.
28 nw4r::ut::Link mLink; ///< Link for the heap's linked list. Managed by the containing heap.
29};
30
31} // namespace EGG
Disposer()
Registers the disposer in the containing heap.
nw4r::ut::Link mLink
Link for the heap's linked list. Managed by the containing heap.
Definition eggDisposer.h:28
virtual ~Disposer()
Unregisters the disposer in the containing heap.
Heap * mHeap
Heap in which the disposer is allocated, or NULL otherwise.
Definition eggDisposer.h:27