2 fegdk: FE Game Development Kit
3 Copyright (C) 2001-2008 Alexey "waker" Yakovenko
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 keltar@users.sourceforge.net
23 #ifndef __F_MMANAGER_H
24 #define __F_MMANAGER_H
27 #include "f_baseobject.h"
33 class pool
: public baseObject
36 explicit pool (uint32 elem_size
, uint32 num_elems
);
45 uint32
*mpLastAllocated
;
52 class stackAllocator
: public baseObject
55 explicit stackAllocator (uint32 size
);
58 uint32
getMark () const;
59 void setMark (uint32 mark
);
61 void *alloc (uint32 size
);
69 class stackAllocatorHandle
72 stackAllocatorHandle () : mpAllocator (g_engine
->getStackAllocator ())
74 mMark
= mpAllocator
->getMark ();
76 stackAllocatorHandle (stackAllocator
&a
) : mpAllocator (&a
)
80 ~stackAllocatorHandle ()
82 mpAllocator
->setMark (mMark
);
85 void *alloc (uint32 size
)
87 return mpAllocator
->alloc (size
);
92 stackAllocator
*mpAllocator
;
96 uint32
getUsedMemorySize ();