| oscript.util.MemberTable
All known Subclasses: oscript.data.OArray,
MemberTable | public interface MemberTable (Code) | | A member table is a special array, with some special methods that don't
need to exist for regular script arrays:
- direct access to the Reference
- pushN() methods
Since the member table is used by scope and to pass args to a function/
constructor, performance is critical, which is the reason for some of these
methods.
author: Rob Clark (rob@ti.com) version: 1 |
Method Summary | |
public void | ensureCapacity(int sz) Ensure that the member-table has sufficient capacity to accomodate the
index sz . | public void | free() Indication from creator of member-table that resources allocated from
the stack are no longer needed and should be released. | public int | length() Get the current size of the member-table. | public void | push1(Value val) Push a single parameter into the table. | public void | push2(Value val1, Value val2) Push two values into the table. | public void | push3(Value val1, Value val2, Value val3) Push three values into the table. | public void | push4(Value val1, Value val2, Value val3, Value val4) Push four values into the table. | public Reference | referenceAt(int idx) Return the reference at the specified index. | public void | reset() An indication from the creator of the member-table that, while the table
itself is still required, the references referred to by the table are
no longer required and can be freed. | public MemberTable | safeCopy() Indication to the member-table that a "safe" copy is required. |
ensureCapacity | public void ensureCapacity(int sz)(Code) | | Ensure that the member-table has sufficient capacity to accomodate the
index sz . Grow the array, if necessary.
Parameters: sz - the requested table size |
free | public void free()(Code) | | Indication from creator of member-table that resources allocated from
the stack are no longer needed and should be released. (If the member
table is needed after this point, a safe copy should have already been
obtained by calling
MemberTable.safeCopy() .)
|
length | public int length()(Code) | | Get the current size of the member-table. The maximum index which
can be referenced via
MemberTable.referenceAt(int) is length()-1
the current size |
push1 | public void push1(Value val)(Code) | | Push a single parameter into the table.
Parameters: val - the value to push |
push2 | public void push2(Value val1, Value val2)(Code) | | Push two values into the table.
Parameters: val1 - the value to push Parameters: val2 - the value to push |
push3 | public void push3(Value val1, Value val2, Value val3)(Code) | | Push three values into the table.
Parameters: val1 - the value to push Parameters: val2 - the value to push Parameters: val3 - the value to push |
push4 | public void push4(Value val1, Value val2, Value val3, Value val4)(Code) | | Push four values into the table.
Parameters: val1 - the value to push Parameters: val2 - the value to push Parameters: val3 - the value to push Parameters: val4 - the value to push |
referenceAt | public Reference referenceAt(int idx)(Code) | | Return the reference at the specified index. This does not necessarily
grow the array, so the user should be sure to use
MemberTable.ensureCapacity(int) to ensure the array has sufficient capacity
before dereferencing an index into the table which is not known to exist.
Parameters: idx - an index into the member-table a reference |
reset | public void reset()(Code) | | An indication from the creator of the member-table that, while the table
itself is still required, the references referred to by the table are
no longer required and can be freed.
|
safeCopy | public MemberTable safeCopy()(Code) | | Indication to the member-table that a "safe" copy is required. This
means that the table may need to outlive the stack-frame that it was
(possibly) allocated from. What it means to convert this table into
a "safe" copy depends on the implementation of the table. A safe
copy is still valid after
MemberTable.free() is called.
a safe copy of this table |
|
|