YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
MemoryMapping.h
浏览该文件的文档.
1 /*
2  © 2012-2014 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 
34 namespace platform
35 {
36 
43 {
44 private:
45  int fd;
46  std::uint64_t size;
48 
49 public:
51 
52  explicit
54  MappedFile(const char*);
56  template<class _tString>
57  explicit
58  MappedFile(const _tString& filename)
59  : MappedFile(filename.c_str())
60  {}
62  ~MappedFile();
63 
65  DefGetter(const ynothrow, ystdex::byte*, Ptr, addr)
67  DefGetter(const ynothrow, std::uint64_t, Size, size)
68 };
69 
70 } // namespace platform;
71 
72 #endif
73 
#define YF_API
Definition: Platform.h:64
unsigned char byte
字节类型。
Definition: ydef.h:555
if(p==MAP_FAILED) throw std addr
只读内存映射文件。
Definition: MemoryMapping.h:42
yconstfn Integer &Trait::AMask Trait::XYZBitsN yconstfn DefGetter(const ynothrow, typename Trait::BType, B, Integer &Trait::XMask) yconstfn DefGetter(const ynothrow
std::size_t size ynothrow
std::uint64_t size
Definition: MemoryMapping.h:46
ystdex::byte * addr
Definition: MemoryMapping.h:47
MappedFile(const _tString &filename)
Definition: MemoryMapping.h:58