Hemi JavaScript Framework
Hemi.data.stack
Description
The Data Stack is a class for storing and retrieving values that may or may not have unique identifiers, and which don't qualify for or need to be stored in the Hemi.registry service.
Class Index
static Hemi.data.stack.service
version
Static instance of TokenStackImpl.
Hemi.data.stack.serviceImpl
version
A class for storing stacks of variant values and filtering the stack by owner.
Index
Object Index
- public Token (internal): Internal object used to store the references that comprise a token.
Property Index
- private enable_overstack: Allows Token objects to be overstacked, meaning that names do not have to be unique. Defaults to false.
- public object_id (internal): Unique instance identifier.
- public object_type (internal): The type of this object.
- public object_version (internal): Version of the object class.
- public ready_state (internal): Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.
Method Index
- public add: Adds a token with the specified name and value for the specified owner.
- public clear: Removes all tokens for the specified owner.
- public get: Returns the specified token.
- public getAll: Returns an array of tokens that match the specified name.
- public getAllByOwner: Returns all tokens for the specified owner.
- public getByOwner: Returns the specified token.
- public getObjectId: Returns the unique id of the object.
- public getObjectType: Returns the type of the object.
- public getObjectVersion: Returns the version of the object.
- public getReadyState: Returns the state of the object.
- public getTokenValue: Returns the value of the specified token.
- public remove: Removes all tokens for the specified owner.
Objects
Token
Internal object used to store the references that comprise a token.
Properties
- owner_id as String: The id of the Token owner.
- index as int: The index of the Token in the local stack.
- token_name as String: The specified name of the token.
- token_value as variant: The specified value of the token.
Properties
enable_overstack
Allows Token objects to be overstacked, meaning that names do not have to be unique. Defaults to false. Property is private and should not be directly referenced.
Syntax
= object.enable_overstack
object.enable_overstack =
object_id
Unique instance identifier.
Syntax
String = object.object_id
object_type
The type of this object.
Syntax
String = object.object_type
object_version
Version of the object class.
Syntax
String = object.object_version
ready_state
Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.
Syntax
int = object.ready_state
Methods
add
Adds a token with the specified name and value for the specified owner.
Syntax
r = add(
o, n, v, b
)
Parameters
- o as object : Registered object that will own the token.
- n as String : Name of the token.
- v as variant : Value of the token.
- b as boolean (optional): Bit indicating whether a token with the same name for the same owner should be overwritten with the new value if it exists. If overstacking is enabled, the new value would be added without overwriting.
Returns
r as boolean: Bit indicating whether the token was added.
clear
Removes all tokens for the specified owner.
Syntax
void clear(
o
)
Parameters
- o as object : A registered object that owns one or more tokens.
get
Returns the specified token.
Syntax
r = get(
n, i
)
Parameters
- n as String : Name of the token.
- i as int (optional): Index of the array for this token name to use to retrieve the value.
Returns
r as Token: The specified token object.
getAll
Returns an array of tokens that match the specified name.
Syntax
a = getAll(
n
)
Parameters
- n as String : Name of the token.
Returns
a as array: Array of tokens that match the specified name.
getAllByOwner
Returns all tokens for the specified owner.
Syntax
r = getAllByOwner(
o
)
Parameters
- o as object : A registered object that owns one or more tokens.
Returns
r as array: Array of tokens belonging to the specified owner.
getByOwner
Returns the specified token.
Syntax
r = getByOwner(
o, n
)
Parameters
- o as object : A registered object that owns a token with the specified name.
- n as String : Name of the token.
Returns
r as Token: The specified token object belonging to the specified owner.
getObjectId
Returns the unique id of the object.
Syntax
i = getObjectId(
)
Returns
i as String: The unique object instance id.
getObjectType
Returns the type of the object.
Syntax
t = getObjectType(
)
Returns
t as String: The type of the object instance.
getObjectVersion
Returns the version of the object.
Syntax
v = getObjectVersion(
)
Returns
v as String: The version of the object instance.
getReadyState
Returns the state of the object.
Syntax
s = getReadyState(
)
Returns
s as int: The object ready state.
getTokenValue
Returns the value of the specified token.
Syntax
r = getTokenValue(
n, i
)
Parameters
- n as String : Name of the token.
- i as int (optional): Index of the array for this token name to use to retrieve the value.
Returns
r as variant: The value of the specified token.
remove
Removes all tokens for the specified owner.
Syntax
void remove(
o, n
)
Parameters
- o as object : A registered object that owns one or more tokens.
- n as String : The name of a token.
[ Hemi JavaScript Framework - Stephen W. Cote, 2002 - 2011. ]