@iqrok/shmop

0.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @iqrok/shmop

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

7.75 kB

Total Files

6

Last publish

Collaborators

  • blogo3x