NGL@1.0.0-beta.7 Home Manual Reference Source Gallery
import Store from 'ngl/src/store/store.js'
public interface | source

Store

Store base class

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public
Private Members
private

Method Summary

Public Methods
public

addField(name: String, size: Integer, type: String): undefined

Add a field

public

Empty the store

public

copyFrom(other: Store, thisOffset: Integer, otherOffset: Integer, length: Integer): undefined

Copy data from one store to another

public

copyWithin(thisOffset: Integer, otherOffset: Integer, length: Integer): undefined

Copy data within this store

public

Dispose of the store entries and fields

public

Resize the store to 1.5 times its current size if full

public

Resize the store to the new size

public

sort(compareFunction: [type]): undefined

Sort entries in the store given the compare function

Private Methods
private

Initialize the store

private

_initField(name: String, size: Integer, type: String): undefined

Initialize a field

Public Constructors

public constructor(size: Integer) source

Params:

NameTypeAttributeDescription
size Integer
  • optional

initial size

Public Members

public [name] source

public count source

public length source

Private Members

private _fields source

Public Methods

public addField(name: String, size: Integer, type: String): undefined source

Add a field

Params:

NameTypeAttributeDescription
name String

field name

size Integer

element size

type String

data type, one of int8, int16, int32, uint8, uint16, uint32, float32

Return:

undefined

public clear(): undefined source

Empty the store

Return:

undefined

public copyFrom(other: Store, thisOffset: Integer, otherOffset: Integer, length: Integer): undefined source

Copy data from one store to another

Params:

NameTypeAttributeDescription
other Store

store to copy from

thisOffset Integer

offset to start copying to

otherOffset Integer

offset to start copying from

length Integer

number of entries to copy

Return:

undefined

public copyWithin(thisOffset: Integer, otherOffset: Integer, length: Integer): undefined source

Copy data within this store

Params:

NameTypeAttributeDescription
thisOffset Integer

offset to start copying to

otherOffset Integer

offset to start copying from

length Integer

number of entries to copy

Return:

undefined

public dispose(): undefined source

Dispose of the store entries and fields

Return:

undefined

public growIfFull(): undefined source

Resize the store to 1.5 times its current size if full

Return:

undefined

public resize(size: Integer): undefined source

Resize the store to the new size

Params:

NameTypeAttributeDescription
size Integer

new size

Return:

undefined

public sort(compareFunction: [type]): undefined source

Sort entries in the store given the compare function

Params:

NameTypeAttributeDescription
compareFunction [type]

function to sort by

Return:

undefined

Private Methods

private _init(size: Integer): undefined source

Initialize the store

Params:

NameTypeAttributeDescription
size Integer

size to initialize

Return:

undefined

private _initField(name: String, size: Integer, type: String): undefined source

Initialize a field

Params:

NameTypeAttributeDescription
name String

field name

size Integer

element size

type String

data type, one of int8, int16, int32, uint8, uint16, uint32, float32

Return:

undefined