Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
InstanceManager.h
Go to the documentation of this file.
1#ifndef NW4HBM_INSTANCEMANAGER_H
2#define NW4HBM_INSTANCEMANAGER_H
3
4#include "../ut/LinkList.h"
5
6namespace nw4hbm {
7 namespace snd {
8 namespace detail {
9 template <typename T, int Ofs>
11 public:
13 void Append(T* obj) {
14 NW4HBM_ASSERT_CHECK_NULL(67, obj);
15 mFreeList.PushBack(obj);
16 }
17
18 void Remove(T* obj) {
19 NW4HBM_ASSERT_CHECK_NULL(84, obj);
20 mFreeList.Erase(obj);
21 }
22
23 T* Alloc() {
24 if (mFreeList.IsEmpty()) {
25 return NULL;
26 } else {
27 T& obj = mFreeList.GetFront();
28 mFreeList.PopFront();
29 mActiveList.PushBack(&obj);
30 return &obj;
31 }
32 }
33 void Free(T* obj) {
34 NW4HBM_ASSERT_CHECK_NULL(119, obj);
35
36 if (!mActiveList.IsEmpty()) {
37 mActiveList.Erase(obj);
38 mFreeList.PushBack(obj);
39 }
40 }
41
42 Iterator GetBeginIter() { return mActiveList.GetBeginIter(); }
43 Iterator GetEndIter() { return mActiveList.GetEndIter(); }
44
45 private:
48 };
49 } // namespace detail
50 } // namespace snd
51} // namespace nw4hbm
52
53#endif
Definition InstanceManager.h:10
void Remove(T *obj)
Definition InstanceManager.h:18
ut::LinkList< T, Ofs >::Iterator Iterator
Definition InstanceManager.h:12
void Append(T *obj)
Definition InstanceManager.h:13
T * Alloc()
Definition InstanceManager.h:23
ut::LinkList< T, Ofs > mFreeList
Definition InstanceManager.h:46
Iterator GetBeginIter()
Definition InstanceManager.h:42
void Free(T *obj)
Definition InstanceManager.h:33
Iterator GetEndIter()
Definition InstanceManager.h:43
ut::LinkList< T, Ofs > mActiveList
Definition InstanceManager.h:47
Definition HBMAnmController.h:6