]>
Commit | Line | Data |
---|---|---|
bd6521f0 A |
1 | // |
2 | // UtilMappedFile.h | |
3 | // CPPUtil | |
4 | // | |
5 | // Created by James McIlree on 4/19/13. | |
6 | // Copyright (c) 2013 Apple. All rights reserved. | |
7 | // | |
8 | ||
9 | #ifndef __CPPUtil__UtilMappedFile__ | |
10 | #define __CPPUtil__UtilMappedFile__ | |
11 | ||
12 | class MappedFile { | |
13 | protected: | |
14 | unsigned char* _address; | |
15 | size_t _size; | |
16 | ||
17 | public: | |
18 | MappedFile(const char* path); | |
19 | ~MappedFile(); | |
20 | ||
21 | uint8_t* address() { return _address; } | |
22 | size_t size() { return _size; } | |
23 | ||
24 | bool mmap_failed() const { return _size > 0 && _address == nullptr; } | |
25 | }; | |
26 | ||
27 | #endif /* defined(__CPPUtil__UtilMappedFile__) */ |