ipmmap package

Submodules

ipmmap.mmap_manager module

class ipmmap.mmap_manager.AbstractMmapManger(mmapDir: Optional[Path] = None, fastenerDir: Optional[Path] = None, logger: Optional[Logger] = None)

Bases: object

ipmmap.struct_mmap_manager module

MmapManager for ctypes.Structure

class ipmmap.struct_mmap_manager.BaseStructMmapManager(structName: str, tag: str = '', mmapDir: Optional[Path] = None, fastenerDir: Optional[Path] = None)

Bases: AbstractMmapManger

Base class for StructMmapReader, Editor and Manager

getLastUpdate() float

Returns last-update time of IPMMAP’s shared memory as the UNIX epoch time (float).

This time can edit only DataStructMmapEditor.updateLastUpdate(). The default value of last-update time is 0.

Returns

UNIX epoch time

Return type

float

static setUserStructs(moduleNameList)
class ipmmap.struct_mmap_manager.DataStructMmapEditor(structName: str, tag: str = '', mmapDir: Optional[Path] = None, fastenerDir: Optional[Path] = None)

Bases: DataStructMmapReader

IPMMAP handler class with a editor privilege.

clearMappedBuffer() None

Fill IPMMAP’s shared memory space with zero.

This method also fills last-update time with zero.

referMappedBuffer()

Return a IPMMAP’s Structure object that is refered shared memory fields. You can edit shared memory field directory, by editing the returned object. caution! You must remove referrence for shared memory field, before you exit from with statement.

Returns

IPMMAP’s Structure object

Return type

ctypes.Structure

updateLastUpdate() None

Update last update time of the IPMMAP’s shared memory.

writeData(key: str, value: Any) None

Set a value of designated a key-string any IPMMAP Structure’s fields

Parameters
  • key (str) – String of a IPMMAP Structure’s field name

  • value (Any) – Value to write for IPMMAP’s shared memory space

class ipmmap.struct_mmap_manager.DataStructMmapManager(structName: str, tag: str = '', mmapDir: Optional[Path] = None, fastenerDir: Optional[Path] = None, create: bool = False, force: bool = False)

Bases: DataStructMmapEditor

IPMMAP handler class with a manager privilege.

closeMemory()

Close the file object and the mmap instance explicitly.

openMemory()

Map explicitly the IPMMAP’s structure to shared memory space.

This method will open both the file object and get the mmap instance. if you want to close resources or stop the process, you need to call closeMemory().

class ipmmap.struct_mmap_manager.DataStructMmapReader(structName: str, tag: str = '', mmapDir: Optional[Path] = None, fastenerDir: Optional[Path] = None)

Bases: BaseStructMmapManager

IPMMAP handler class with a reader privilege.

readData(key: str) any

Returns a value of designated a key-string any IPMMAP Structure’s fields.

Parameters

key (str) – string of the IPMMAP Structure’s field name

Returns

value

Return type

any

readMappedBuffer()

Return a IPMMAP’s Structure object that is copied from shared memory fields.

Returns

copied IPMMAP’s Structure object

Return type

ctypes.Structure

Module contents