YSTest: MemoryMapping.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

MemoryMapping.h
浏览该文件的文档.
1 /*
2 © 2012-2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YCL_INC_MemoryMapping_h_
29 #define YCL_INC_MemoryMapping_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YCLib_YCommon
33 #include YFM_YCLib_Reference // for default_delete, unique_ptr;
34 #include YFM_YCLib_FileIO
35 #include YFM_YBaseMacro
36
37 namespace platform
38 {
39
40 #if YCL_DS
41 using UnmapDelete = default_delete<byte[]>;
43 #else
44 class YF_API UnmapDelete
46 {
47 public:
48 using pointer = byte*;
49
50 # if !YCL_Win32
51 private:
52 size_t size;
53 # endif
54
55 public:
56 # if YCL_Win32
57 DefDeCtor(UnmapDelete)
58 # else
59 UnmapDelete(size_t s)
60 : size(s)
61 {}
62 # endif
63
65 void
66 operator()(pointer) const ynothrow;
67 };
68 #endif
69
75 class YF_API MappedFile
76 {
77 private:
79 UniqueFile file;
80 std::uint64_t size;
82 unique_ptr<byte[], UnmapDelete> addr;
83
84 public:
90 explicit
92 MappedFile(const char*);
94 template<class _tString>
95 explicit
96 MappedFile(const _tString& filename)
97 : MappedFile(filename.c_str())
98 {}
100 DefDeDtor(MappedFile)
101
102
103 DefGetter(const ynothrow, byte*, Ptr, addr.get())
105 DefGetter(const ynothrow, std::uint64_t, Size, size)
106 };
107
108 } // namespace platform;
109
110 #endif
111
platform::UnmapDelete::UnmapDelete
UnmapDelete(size_t s)
Definition: MemoryMapping.h:59
platform::UnmapDelete
Definition: MemoryMapping.h:45
platform::MappedFile::file
UniqueFile file
Definition: MemoryMapping.h:79
platform::UniqueFile
unique_ptr_from< FileDescriptor::Deleter > UniqueFile
Definition: FileIO.h:427
platform::MappedFile::addr
unique_ptr< byte[], UnmapDelete > addr
Definition: MemoryMapping.h:82
platform
默认平台命名空间。
Definition: Container.h:47
platform::UnmapDelete::pointer
byte * pointer
Definition: MemoryMapping.h:48
std
Definition: memory.hpp:1100
platform::ynothrow
const _tString &path ynothrow
Definition: YCLib/FileSystem.h:303
platform::MappedFile::size
std::uint64_t size
Definition: MemoryMapping.h:80
platform::DefDeCtor
DefDeCtor(BGRA) yconstfn BGRA(typename Trait
Definition: Video.h:152
platform::MappedFile::MappedFile
MappedFile(const _tString &filename)
Definition: MemoryMapping.h:96
YModules.h
ystdex::byte
unsigned char byte
字节类型。
Definition: ydef.h:808
DefDeDtor
#define DefDeDtor(_t)
Definition: YBaseMacro.h:176
platform::MappedFile
只读内存映射文件。
Definition: MemoryMapping.h:75
NPL::c_str
YF_API const char src c_str())) YF_API void InstallDirectory(const string &
安装目录：复制目录树。
YF_API
#define YF_API
Definition: Platform.h:56
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140
platform::UnmapDelete::size
size_t size
Definition: MemoryMapping.h:52
platform::DefGetter
yconstfn Integer &MaskTrait::AMask MaskTrait::XYZMaskN yconstfn DefGetter(const ynothrow, typename Trait::BType, B, Integer &MaskTrait::XMask) yconstfn DefGetter(const ynothrow