ScummVM API documentation
heapmem.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * This file contains the handle based Memory Manager defines
21 */
22
23#ifndef TINSEL_HEAPMEM_H
24#define TINSEL_HEAPMEM_H
25
26#include "tinsel/dw.h" // new data types
27
28namespace Tinsel {
29
30struct MEM_NODE;
31
32
33/*----------------------------------------------------------------------*\
34|* Memory Function Prototypes *|
35\*----------------------------------------------------------------------*/
36
37void MemoryInit(); // initializes the memory manager
38void MemoryDeinit(); // deinitializes the memory manager
39
40// reserves a memory node for a movable & discardable block
41MEM_NODE *MemoryNoAlloc();
42
43// allocates a fixed block with the specified number of bytes
44MEM_NODE *MemoryAllocFixed(long size);
45
46void MemoryDiscard( // discards the specified memory object
47 MEM_NODE *pMemNode); // node of the memory object
48
49void *MemoryLock( // locks a memory object and returns a pointer to the first byte of the objects memory block
50 MEM_NODE *pMemNode); // node of the memory object
51
52void MemoryReAlloc( // changes the size or attributes of a specified memory object
53 MEM_NODE *pMemNode, // node of the memory object
54 long size); // new size of block
55
56void MemoryUnlock( // unlocks a memory object
57 MEM_NODE *pMemNode); // node of the memory object
58
59// 'touch' the memory object, i.e., update its "least recently used" counter.
60void MemoryTouch(MEM_NODE *pMemNode);
61
62// Dereference a given memory node
63uint8 *MemoryDeref(MEM_NODE *pMemNode);
64
65} // End of namespace Tinsel
66
67#endif
Definition: actors.h:36