1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     os_SimpleAutoStackManager.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev:$
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_OS_OS_SIMPLEAUTOSTACKMANAGER_H_
17 #define NN_OS_OS_SIMPLEAUTOSTACKMANAGER_H_
18 
19 #include <nn/config.h>
20 #if NN_PLATFORM_HAS_MMU
21 
22 #ifdef __cplusplus
23 
24 #include <nn/os/os_Mutex.h>
25 #include <nn/os/os_SimpleAutoStackManagerBase.h>
26 
27 namespace nn {
28     namespace fnd
29     {
30         class IAllocator;
31     }
32 
33 namespace os {
34 
35 
36     /* Please see man pages for details
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51     */
52     class SimpleAutoStackManager : public SimpleAutoStackManagerBase
53     {
54     private:
55         typedef SimpleAutoStackManagerBase Base;
56 
57     public:
58         /* Please see man pages for details
59 
60 
61 
62         */
SimpleAutoStackManager()63         SimpleAutoStackManager(){}
64 
65         /* Please see man pages for details
66 
67 
68 
69 
70 
71 
72         */
~SimpleAutoStackManager()73         virtual ~SimpleAutoStackManager(){}
74 
75         /* Please see man pages for details
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99         */
Initialize(fnd::IAllocator * pAllocator,uptr stackBottom)100         void Initialize(fnd::IAllocator* pAllocator, uptr stackBottom)
101         { Base::Initialize(pAllocator, stackBottom); }
102 
103         /* Please see man pages for details
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117         */
118         template <typename StackT>
Initialize(fnd::IAllocator * pAllocator,StackT & stack)119         void Initialize(fnd::IAllocator* pAllocator, StackT& stack)
120         {
121             Initialize(pAllocator, stack.GetStackBottom());
122         }
123 
124         /* Please see man pages for details
125 
126 
127 
128         */
Finalize()129         uptr Finalize()
130         { return Base::Finalize(); }
131 
132         /* Please see man pages for details
133 
134 
135 
136 
137 
138         */
139         virtual void* Construct(size_t stackSize);
140 
141         /* Please see man pages for details
142 
143 
144 
145 
146 
147 
148         */
Destruct(void * pStackBottom,bool isError)149         virtual void Destruct(void* pStackBottom, bool isError)
150         { Base::DestructImpl(pStackBottom, isError); }
151 
152     private:
153         virtual void FreeStack(void* pStackBottom);
154     };
155 
156 
157 }} // namespace nn::os
158 
159 #endif // __cplusplus
160 
161 #endif  // if NN_PLATFORM_HAS_MMU
162 #endif /* NN_OS_OS_SIMPLEAUTOSTACKMANAGER_H_ */
163