Skip to content
ben-sangster edited this page Oct 9, 2010 · 5 revisions

Description

The object module is a runtime database that stores attributes of objects. These objects maybe owned locally or remotely. Each object may have multiple attributes of the same type. For example an object may have a current position and a position that represents the last position that was transmitted over the network. An attribute handle is used to access the different attributes of a given type. The object module supports both a push and pull model for attribute updates. The lookup_* functions may be used to pull object attributes from the object module. An object observer is used to push attribute updates. An object observer is registered with the object module and may subscribe to specific attributes. After registration, the object observer will be notified whenever an object's attributes are updated. Attribute handles are what allow multiple values to be stored in one attribute. Most attributes relating to the current object state are stored with the default attribute handle defined by the String variable dmz::ObjectAttributeDefaultName. Attributes that represent the last network value transmitted or received are stored with the attribute handle defined by the String variable dmz::ObjectAttributeLastNetworkValueName. Attribute handles are named handles allocated by the runtime. Since attribute handles are runtime allocated, the attribute handle value should never be hard coded as it will most likely be a different value from run to run. Zero is considered an invalid attribute handle.

Functions

API

Found in "dmz/components/object"

API Constants

  • LocalityUnknown
  • Local
  • Remote
  • RetainLinks
  • IgnoreLinks
  • SelectNew
  • SelectAdd
  • DefaultAttribute
  • HILAttribute
  • LNVAttribute
  • SelectAttribute
  • HideAttribute

API Functions

Handle hil ()

Bool release (Object o, [Function fnc])

Bool isObject (Handle h)

Bool isActivated (Handle h)

Bool isLink (Handle h)

Handle[] getObjects ()

Handle create (ObjectType t, Locality loc)

Bool activate (Handle h)

Bool destroy (Handle h)

Handle clone (Handle h, ObjectLinkRetentionEnum lr)

Bool makePersistent (Handle h)

ObjectType type (Handle h)

Handle link (Handle attr, Handle super, Handle sub)

Handle linkHandle (Handle attr, Handle super, Handle sub)

Object: {attribute, super, sub} linkedObjects (Handle link)

Bool unlink (Handle link)

Bool unlinkSuperObjects (Handle object, Handle attr)

Bool unlinkSubObjects (Handle object, Handle attr)

Handle[] superLinks (Handle object, Handle attr)

Handle[] subLinks (Handle object, Handle attr)

Handle[] attributeObjectLinks (Handle h)

  • The below functions represent getter and setter functions.
  • If the optional argument is given, the specified object will have its value set
  • If the optional argument is not given, the object's value will be returned.

Locality locality (Handle h, [Locality l])

String uuid (Handle h, null, [String value])

Handle linkAttributeObject (Handle link, [Handle object])

Number addToCounter (Handle h, Handle attr, [Number value])

Number counter (Handle h, Handle attr, [Number value])

Number counter.min (Handle h, Handle attr, [Number value])

Number counter.max (Handle h, Handle attr, [Number value])

Bool counter.rollover (Handle h, Handle attr, [Bool value])

ObjectType altType (Handle h, Handle attr, [ObjectType o])

State state (Handle h, Handle attr, [State state])

Bool flag (Handle h, Handle attr, [Bool flag])

Number timeStamp (Handle h, Handle attr, [Number value])

Vector position (Handle h, Handle attr, [Vector v])

Matrix orientation (Handle h, Handle attr, [Matrix m])

Vector velocity (Handle h, Handle attr, [Vector v])

Vector acceleration (Handle h, Handle attr, [Vector v])

Vector scale (Handle h, Handle attr, [Vector v])

Vector vector (Handle h, Handle attr, [Vector v])

Number scalar (Handle h, Handle attr, [Number value])

String text (Handle h, Handle attr, [String text])

Data data (Handle h, Handle attr, [Data d])

Handle[] getSelected ()

Bool isSelected (Handle h)

Bool select (Handle h, [Number value])

Bool unselect (Handle h)

void unselectAll ()

  • The following functions are in the following pattern, with the same arguments and return type:

Bool name.remove (Handle obj, Handle attr)

counter.remove

counter.min.remove

counter.max.remove

altType.remove

state.remove

flag.remove

timeStamp.remove

position.remove

orientation.remove

velocity.remove

acceleration.remove

scale.remove

vector.remove

scalar.remove

text.remove

data.remove

  • The following functions set up observers and take functions as arguments and all return pointers to the functions that are given as arguments. Those functions are called when the specified attribute changes.
  • Listed next to each function name is list of arguments given to the functions that are called on update.
  • Each function below has the following type: FunctionPtr name.observe (self, Handle h, Function fnc)

create.observe

destroy.observe

locality.observe (Handle obj, Locality l, Locality prev)

uuid.observe (Handle obj, String id, String prevId)

link.observe (Handle link, Handle attr, Handle super, Handle sub)

unlink.observe (Handle link, Handle attr, Handle super, Handle sub)

linkAttributeObject.observe (Handle Link, Handle attr, Handle super, Handle sub, Handle attrObj, Handle prevAttrObj)

counter.observe (Handle obj, Handle attr, Handle value, Handle prev)

counter.min.observe (Handle obj, Handle attr, Number value, Number prev)

counter.max.observe (Handle obj, Handle attr, Number value, Number prev)

state.observe (Handle obj, Handle attr, State val, State prev)

flag.observe (Handle obj, Handle attr, Bool flag, Bool prev)

timeStamp.observe (Handle obj, Handle attr, Number value, Number prev)

position.observe (Handle obj, Handle attr, Vector value, Vector prev)

orientation.observe (Handle obj, Handle attr, Matrix m, Matrix prev)

velocity.observe (Handle obj, Handle attr, Vector v, Vector prev)

acceleration.observe (Handle obj, Handle attr, Vector v, Vector prev)

scale.observe (Handle obj, Handle attr, Vector v, Vector prev)

vector.observe (Handle obj, Handle attr, Vector v, Vector prev)

scalar.observe (Handle obj, Handle attr, Number val, Number prev)

text.observe (Handle obj, Handle attr, String text, String prev)

data.observe (Handle obj, Handle attr, Data d, Data prev)

Clone this wiki locally