ScummVM API documentation
memory.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  */
21 
22 #ifndef LURE_MEMORY_H
23 #define LURE_MEMORY_H
24 
25 
26 #include "common/system.h"
27 #include "common/str.h"
28 
29 namespace Lure {
30 
31 class MemoryBlock {
32 private:
33  byte *_data;
34  uint32 _size;
35 public:
36  MemoryBlock(uint32 size);
38  ~MemoryBlock();
39 
40  byte *data() { return _data; }
41  uint32 size() { return _size; }
42 
43  void empty();
44  void setBytes(int c, size_t startIndex, size_t num);
45  void copyFrom(MemoryBlock *src);
46  void copyFrom(MemoryBlock *src, uint32 srcPos, uint32 destPos, uint32 srcLen);
47  void copyFrom(const byte *src, uint32 srcPos, uint32 destPos, uint32 srcLen);
48  void reallocate(uint32 size);
49 };
50 
51 class Memory {
52 public:
53  static MemoryBlock *allocate(uint32 size);
54  static MemoryBlock *duplicate(MemoryBlock *src);
55  static void *alloc(uint32 size);
56  static void dealloc(void *block);
57 };
58 
59 } // end of namspace Lure
60 
61 #endif
Definition: animseq.h:27
Definition: memory.h:31
Definition: memory.h:51