new CircularRecordBuffer([params])

Example

// TODO

Parameters

Name Type Optional Description

params

Object

Yes

Constructor parameters.

param.store

module:qm.Store

 

Store for the records in the buffer.

param.size

number

 

Size of the buffer (number of records).

param.onAdd

function()

Yes

Callback executed when new record is added to the buffer. Callback is give two parameters:
rec - The record. Type module:qm.Record.
circRecBuff - The circular record buffer instance. Type module:qm.CircularRecordBuffer.

param.onDelete

function()

Yes

Callback executed when record is removed from the buffer. Callback is give two parameters:
rec - The record. Type module:qm.Record.
circRecBuff - The circular record buffer instance. Type module:qm.CircularRecordBuffer.

Methods

load(fin)

Load circular buffer from input stream. Assumes store, onAdd and onDelete were already initialized in constructor.

Example

// TODO

Parameter

Name Type Optional Description

fin

module:fs.FIn

 

input stream.

push(rec)

Add new record to the buffer.

Example

// TODO

Parameter

Name Type Optional Description

rec

module:qm.Record

 

New record.

save(fout) → module:fs.FOut

Saves circular buffer to the output stream. Does not save store, onAdd and onDelete callbacks.

Example

// TODO

Parameter

Name Type Optional Description

fout

module:fs.FOut

 

Output stream.

Returns

module:fs.FOutB The output stream fout.