summaryrefslogtreecommitdiff
path: root/include/egg/core/eggDisposer.h
blob: cc311ace7b1190f62c4a4ec7b56164a8de3b837b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef EGG_DISPOSER_H
#define EGG_DISPOSER_H

// This file was adapted from https://github.com/riidefi/mkw/blob/master/source/egg/core/eggDisposer.hpp

#include "common.h"

#include "nw4r/ut.h"


namespace EGG {

class Heap;
class Disposer : private NonCopyable {
public:
    /* vt 0x08 */ virtual ~Disposer();
    Disposer();

public:
    enum eLifetime {
        LIFETIME_UNMANAGED,
        LIFETIME_HEAP_GC
    };
    inline eLifetime getLifetime() const {
        return mContainHeap != nullptr ? LIFETIME_HEAP_GC : LIFETIME_UNMANAGED;
    }

private:
    /* 0x04 */ Heap *mContainHeap;
    /* 0x08 */ nw4r::ut::Node mList;
};

// TODO: Add singleton define for the T__Disposer stuff.
// see https://github.com/open-ead/sead/blob/master/include/heap/seadDisposer.h
// for reference

}; // namespace EGG

#endif