-
Notifications
You must be signed in to change notification settings - Fork 2
/
MemoryRegion.h
50 lines (36 loc) · 1.18 KB
/
MemoryRegion.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* MemoryRegion.h
*
* Created on: Nov 20, 2013
* Author: tyler
*/
#ifndef MEMORYREGION_H_
#define MEMORYREGION_H_
#include <cstdint>
#include <string>
#include "Flags.h"
class MemoryRegion
{
public:
enum class ProtectionFlags {None, Read = 1, Write = 2, Execute = 4, Shared = 8};
MemoryRegion(intptr_t startPtr, intptr_t endPtr, intptr_t fileOffset = 0,
const Flags<ProtectionFlags>& flags = ProtectionFlags::None, const std::string& name = "");
~MemoryRegion();
MemoryRegion(const MemoryRegion& other);
MemoryRegion(MemoryRegion&& other);
MemoryRegion& operator =(const MemoryRegion& other);
MemoryRegion& operator =(MemoryRegion&& other);
intptr_t getStartPtr() const {return m_startPtr;}
intptr_t getEndPtr() const {return m_endPtr;}
intptr_t getSize() const{return m_endPtr - m_startPtr;}
intptr_t getFileOffset() const {return m_fileOffset;}
Flags<ProtectionFlags> getProtectionFlags() const {return m_protectionFlags;}
const std::string& getName() const {return m_name;}
protected:
intptr_t m_startPtr = 0;
intptr_t m_endPtr = 0;
intptr_t m_fileOffset = 0;
Flags<ProtectionFlags> m_protectionFlags;
std::string m_name;
};
#endif /* MEMORYREGION_H_ */