@iqrok/shmop
v0.1.0
Published
shm operation binding from cpp to nodejs
Downloads
1
Readme
shmop C binding
Usage
const shmop = require('@iqrok/shmop');
Methods
setPath(path)
- Descriptions set path to generate token with ftok()
- Parameter(s)
- path [String] path to existing file
getToken(id, path = null)
- Descriptions generate token with ftok()
- Parameter(s)
- id [Number] number from 1 - 255. if 0 is passed as id, it will throw error
- path (optional) use path defined via this parameter instead of global path defined via setPath()
- Return [Number] generated token
read(id, type)
- Descriptions read shared memory block pointed by the provided token
- Parameter(s)
- id [Number] if id <= 255, then it will be passed to getToken(), otherwise it will be treated as the token
- type [String] data type that will be read
- Return [Number] Read shared memory
write(id, value, type)
- Descriptions read shared memory block pointed by the provided token
- Parameter(s)
- id [Number] if id <= 255, then it will be passed to getToken(), otherwise it will be treated as the token
- value [Number] value that will be written to shared memory block
- type [String] data type that will be read
- Return [Number] Read shared memory
Valid Data Types
|Type|Description| |---|---| |uint8|8-bit unsigned integer| |int8|8-bit signed integer| |uint16|16-bit unsigned integer| |int16|16-bit signed integer| |uint32|32-bit unsigned integer| |int32|32-bit signed integer| |float|32-bit single precision floating number| |double|64-bit double precision floating number|