2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-02-11 12:54:56 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 01:34:22 +00:00
|
|
|
*
|
2006-02-11 12:54:56 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2006-02-11 12:54:56 +00:00
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:22 +00:00
|
|
|
*
|
2006-02-11 12:54:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-07-23 15:32:14 +00:00
|
|
|
#ifndef LURE_MEMORY_H
|
|
|
|
#define LURE_MEMORY_H
|
2006-02-11 12:54:56 +00:00
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
#include "common/system.h"
|
|
|
|
#include "common/str.h"
|
|
|
|
|
|
|
|
namespace Lure {
|
|
|
|
|
|
|
|
class MemoryBlock {
|
|
|
|
private:
|
|
|
|
byte *_data;
|
|
|
|
uint32 _size;
|
|
|
|
public:
|
|
|
|
MemoryBlock(uint32 size);
|
|
|
|
MemoryBlock(MemoryBlock *src);
|
|
|
|
~MemoryBlock();
|
|
|
|
|
|
|
|
byte *data() { return _data; }
|
|
|
|
uint32 size() { return _size; }
|
|
|
|
|
|
|
|
void empty();
|
2006-02-19 04:02:01 +00:00
|
|
|
void setBytes(int c, size_t startIndex, size_t num);
|
2006-02-11 12:54:56 +00:00
|
|
|
void copyFrom(MemoryBlock *src);
|
|
|
|
void copyFrom(MemoryBlock *src, uint32 srcPos, uint32 destPos, uint32 srcLen);
|
|
|
|
void copyFrom(const byte *src, uint32 srcPos, uint32 destPos, uint32 srcLen);
|
|
|
|
void reallocate(uint32 size);
|
|
|
|
};
|
|
|
|
|
|
|
|
class Memory {
|
|
|
|
public:
|
|
|
|
static MemoryBlock *allocate(uint32 size);
|
|
|
|
static MemoryBlock *duplicate(MemoryBlock *src);
|
2009-10-09 21:47:33 +00:00
|
|
|
static void *alloc(uint32 size);
|
2006-08-27 11:44:39 +00:00
|
|
|
static void dealloc(void *block);
|
2006-02-11 12:54:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end of namspace Lure
|
|
|
|
|
|
|
|
#endif
|