首页 / base / oaMapFile

oaMapFile

模块: oapy._oa._base 导入: from oapy._oa import _base

概览

oaMapFileoapy 中可用,可通过 _base 模块访问。

本页汇总 oaMapFile 当前在 oapy 中可用的 Python 接口。

详细说明

The oaMapFile class implements the basic file-mapping capability for memory-mapped disk files, including functions for reading and writing the file data。 This class has byte-swapping supports for files across machines。 This class supports files larger than 32 bits。 The API allows you to map any 32-bit window of the file at a time。 You cannot map zero-size files。 When you create files, the tool checks the mapping size。 If the file size is zero, the map is not created。 It is the user's responsibility to ensure all writes are aligned on a boundary of the object size to be written。 For example, you must write out shorts on two-byte boundaries, ints on four-byte boundaries, and so on。 Violating this requirement results in a bus-error。 The Win32 and UNIX versions of this class differ due to the differences in file mapping support。 Because of how Win32 supports memory mapping, it is not effective to derive this class from the oaFile class。

构造函数

_base.oaMapFile(nameIn)

obj = _base.oaMapFile(nameIn)

方法总览

状态 Python 调用
obj.map(size, offset, mapLoc=NULL)
obj.unmap(mapLoc, size)
obj.setSize(size)
obj.getMappableSize()
obj.getFirstWindow()
obj.closeWindows()
obj.isMapped()
obj.getSwap()
obj.setSwap(swapIn)

方法说明

obj.map(size, offset, mapLoc=NULL)

绑定状态: 已绑定

Python 调用: obj.map(size, offset, mapLoc=NULL)

This function maps a portion of the file associated with this oaMapFile object into memory using the specified access mode。 The size and offset are adjusted to reflect operating system alignment and map size restrictions。 The size bytes starting at set in the file are mapped。 If the file is empty, this function will not map anything。 If size is zero, the portion of the file between offset and the end of the file are mapped, with a 32-bit limitation。 For write mode, if the file is not currently mapped it is extended if necessary。

异常

  • oacInvalidFileAccessMode
  • oacInvalidFileSize
  • oacInvalidMapFileWindow
  • oacFileMappingFailed

Python 示例

from oapy._oa import _base

# assume obj is a oaMapFile
obj.map(size, offset, mapLoc=NULL)

obj.unmap(mapLoc, size)

绑定状态: 已绑定

Python 调用: obj.unmap(mapLoc, size)

This function closes the memory-map at the given memory location。 This mapFile object remains valid。

异常

  • oacMemMapCloseFailed

Python 示例

from oapy._oa import _base

# assume obj is a oaMapFile
obj.unmap(mapLoc, size)

obj.setSize(size)

绑定状态: 已绑定

Python 调用: obj.setSize(size)

This function sets the size of this file to the specified value。 The file must be open for this function to succeed。

参数

  • size: The new size of the file。

异常

  • oacFileTruncateFailed

Python 示例

from oapy._oa import _base

# assume obj is a oaMapFile
obj.setSize(size)

obj.getMappableSize()

绑定状态: 已绑定

Python 调用: obj.getMappableSize()

This function returns the size of the portion of the file that is currently mappable。 The mappable size is established when the first window is opened。 If no windows are currently open, this function returns the current file size。

Python 示例

from oapy._oa import _base

# assume obj is a oaMapFile
obj.getMappableSize()

obj.getFirstWindow()

绑定状态: 已绑定

Python 调用: obj.getFirstWindow()

This function returns the first mapWindow associated with this map file。

Python 示例

from oapy._oa import _base

# assume obj is a oaMapFile
obj.getFirstWindow()

obj.closeWindows()

绑定状态: 已绑定

Python 调用: obj.closeWindows()

This function closes all of the memory-mapped windows associated with this file。

Python 示例

from oapy._oa import _base

# assume obj is a oaMapFile
obj.closeWindows()

obj.isMapped()

绑定状态: 已绑定

Python 调用: obj.isMapped()

This function returns true if this file is mapped。

返回

  • true or false。

Python 示例

from oapy._oa import _base

# assume obj is a oaMapFile
obj.isMapped()

obj.getSwap()

绑定状态: 已绑定

Python 调用: obj.getSwap()

This function returns a boolean indicating whether this file requires byte-swapping。

返回

  • true or false。

Python 示例

from oapy._oa import _base

# assume obj is a oaMapFile
obj.getSwap()

obj.setSwap(swapIn)

绑定状态: 已绑定

Python 调用: obj.setSwap(swapIn)

This function sets the byte-swapping flag for this map file to indicate it requires byte-swapping。

Python 示例

from oapy._oa import _base

# assume obj is a oaMapFile
obj.setSwap(swapIn)