VarSpace
|
Description:This object is designed to allow the storage and retrieval of named values from a stack. Each layer of the stack references a "Variables" collection of "Variable" objects. Named values are stored to and retrieved from the stack using one of two main API's.
- The LocalValue properties store and retrieve values only from the top of stack.
- The Value properties offer the same functionality while allowing variables to be inherited from any level within the stack.
- The GetValue and SetValue methods allow the user to supply parameters to mimic either of the above API's and to create ReadOnly variables.
Author:
Andrew FriedlCopyright:
1997.03.10, BlackBox Software & Consulting
General Methods
object members |
|
Peek
|
Public Property Get Peek(Optional Index As Variant) As Variables
Retrieve a reference to any layer of the stack. |
Count
|
Public Property Get Count() As Integer
The number of Variables collection stored on the stack. |
Value
|
Public Property Get Value(Name As String) As Variant
Retrieves a value from the stack. |
Value
|
Public Property Let Value(Name As String, Value As Variant)
Stores a value to a named variable within the stack. |
Value
|
Public Property Set Value(Name As String, Value As Variant)
Stores an object reference to a named variable within the stack. |
LocalValue
|
Public Property Get LocalValue(Name As String) As Variant
Retrieves a named value from the top of stack. |
LocalValue
|
Public Property Let LocalValue(Name As String, Value As Variant)
Stores a non-object value to a variable at the top of stack. |
LocalValue
|
Public Property Set LocalValue(Name As String, Value As Variant)
Stores an object reference to a variable at the top of stack. |
Push
|
Public Function Push(Optional Vars) As Variables
Pushes a new Variables collection to the top of the stack. |
Pop
|
Public Function Pop() As Variables
Removes the top of stack Variables object from the stack. |
GetValue
|
Public Function GetValue(Name As String, Value As Variant, Optional LocalOnly) As Boolean
Retrieves a named value from the stack. |
SetValue
|
Public Function SetValue(Name As String, Value As Variant, Optional ReadOnly As Variant, Optional LocalOnly As Variant) As Boolean
Stores a named value within the stack. |
AliasValue
|
Public Function AliasValue(NewName As String, Name As String, Optional ReadOnly As Variant, Optional LocalOnly As Variant) As Boolean
Creates an alias to an existing named value. |
Search
|
Public Function Search(Name As String, Var As Variable, Optional LocalOnly As Variant) As Boolean
Searches the stack for a variable. |
SearchLocal
|
Public Function SearchLocal(Name As String, Var As Variable) As Boolean
Searches the stack for a named variable object only at the local level. |
SearchScope
|
Public Function SearchScope(Name As String, Value As Variable) As Boolean
Searches the entire stack for a named variable object. |
General Methods - Detail
object members |
Retrieve a reference to any layer of the stack.
Description:
By default this property returns a reference of the Variables collection that is "top of stack". Using the optional Index parameter allows the retrieval of any layer in the stack.Definition:
Public Property Get Peek(Optional Index As Variant) As Variables
Parameters: An optional parameter that may be used to specify a specific layer. Returns:
A Variables collection.
The number of Variables collection stored on the stack.
Definition:
Public Property Get Count() As Integer
Returns:
An integer.
Retrieves a value from the stack.
Description:
Thus property retrieves a named value from the variable stack. If the value does not exist at the top of stack level, it will be sought at a lower level until all levels have been exhausted. If the value cannot be located an exception will be thrown.Definition:
Public Property Get Value(Name As String) As Variant
Returns:
A variant that is the current value of the named variable.
Stores a value to a named variable within the stack.
Description:
Thus property stores an object reference to the variable stack. If the value does not exist at the top of stack level, it will be sought at a lower level until all levels have been exhausted. If the value cannot be located it will be created at the top of stack level.Definition:
Public Property Let Value(Name As String, Value As Variant)
Parameters: Name The name of the value to be stored. Value The value to be stored.
Stores an object reference to a named variable within the stack.
Description:
Thus property stores an object reference to the variable stack. If the value does not exist at the top of stack level, it will be sought at a lower level until all levels have been exhausted. If the value cannot be located it will be created at the top of stack level.Definition:
Public Property Set Value(Name As String, Value As Variant)
Parameters: Name The name of the value to be stored. Value The value to be stored.
Retrieves a named value from the top of stack.
Description:
Thus function retrieves a named value from the top of stack. If the value does not exist an exception will be thrown.Definition:
Public Property Get LocalValue(Name As String) As Variant
Parameters: Name The name of the value to be retrieved. Returns:
A variant that is the current value of the named variable.
Stores a non-object value to a variable at the top of stack.
Description:
Thus property stores a value to the variable stack. If the value does not exist at the top of stack level, it will be created at that level.Definition:
Public Property Let LocalValue(Name As String, Value As Variant)
Parameters: Name The name of the value to be stored. Value The value to be stored.
Stores an object reference to a variable at the top of stack.
Description:
Thus property stores an object reference to the variable stack. If the value does not exist at the top of stack level, it will be created at that level.Definition:
Public Property Set LocalValue(Name As String, Value As Variant)
Parameters: Name The name of the value to be stored. Value The value to be stored.
Pushes a new Variables collection to the top of the stack.
Description:
Thus function places a new Variables collection on the top of the stack. Optionally, a Variables collection may be passed as a parameter. If one is supplied it is pushed to the top of stack, if not, a new Variables collection is created and placed on the stack.Definition:
Public Function Push(Optional Vars) As Variables
Parameters: Vars A Variables compatible object to be pushed to the top of the stack. (optional) Returns:
The Variables object that was placed on the top of stack.
Removes the top of stack Variables object from the stack.
Description:
Thus function removes the current Variables object from the top of the stack. An exception may be thrown if an attempt is made to pop the lowest (the zero) level of the stack.Definition:
Public Function Pop() As Variables
Returns:
The Variables object removed from the stack.
Retrieves a named value from the stack.
Description:
Thus function retrieves a named value from variable stack. By default, the value will be sought at all lower levels if it is not located at the top of stack.Definition:
Public Function GetValue(Name As String, Value As Variant, Optional LocalOnly) As Boolean
Parameters: Name The name of the value to be retrieved. Value A reference to the Variant where the value should be stored. LocalOnly An optional value used to indicate that the variable lookup is to be performed only at the highest level of the stack. Returns:
True if the value is found, False otherwise.
Stores a named value within the stack.
Description:
Thus function stores a named value to the variable stack. By default, the value will be sought at all lower levels if the value is not found at the top of stack.Definition:
Public Function SetValue(Name As String, Value As Variant, Optional ReadOnly As Variant, Optional LocalOnly As Variant) As Boolean
Parameters: Name The name of the value to be retrieved. Value A reference to the Variant where the value should be stored. ReadOnly An optional value used to indicate that the variable should be a readonly value. This parameter only applies when the variable is initially created. LocalOnly An optional value used to indicate that the variable is is to be set only at the highest level of the stack and not inheritance is to be used. Returns:
True if the value is set, False otherwise.
Creates an alias to an existing named value.
Description:
Thus function creates a named variable that is an alias to an existing variable. Reads and writes may still occur to the aliased variable as well as the new alias. Additionally, traces may be added to or removed from each variable independently of the other, however, traces to the alias will not occur if the original variable is modified. All aliased variables are created at the current top of stack.Definition:
Public Function AliasValue(NewName As String, Name As String, Optional ReadOnly As Variant, Optional LocalOnly As Variant) As Boolean
Parameters: NewName The name of the new alias variable. Name The name of the variable to be aliased. ReadOnly (optional) Flag indicating the new Alias to be readonly. LocalOnly (optional) Flag indicating the search method for the variable to be aliased. Returns:
True if the variable was aliased, False otherwise.
Searches the stack for a variable.
Description:
Thus function searches the variable stack for a variable. By default, the entire stack is searched, unless otherwise modified by optional parameters. If the variable is located, the parameter Var will be set to a reference to the variable.Definition:
Public Function Search(Name As String, Var As Variable, Optional LocalOnly As Variant) As Boolean
Parameters: Name The name of the variable to be located. Var The reference to be set if the variable is located. LocalOnly (optional) Flag indicating the search method for the variable. Returns:
True if the variable is found, False otherwise.
Searches the stack for a named variable object only at the local level.
Description:
Thus function searches the top of stack for a named variable. If the variable is located, the parameter Value will be set to a reference to the variable.Definition:
Public Function SearchLocal(Name As String, Var As Variable) As Boolean
Parameters: Name The name of the variable to be located. Var The reference to be set if the variable is located. Returns:
True if the variable is found, False otherwise.
Searches the entire stack for a named variable object.
Description:
Thus function searches the entire variable stack for a named variable. The stack is searched from the current top of stack downward. Searching terminates when the first occurance of the named variable is found, or when the bottom of of the stack is reached without a successful match.Definition:
Public Function SearchScope(Name As String, Value As Variable) As Boolean
Parameters: Name The name of the variable to be located. Value the reference to be set if the variable is located. Returns:
True if the variable is found, False otherwise.