![]() |
Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
|
Collection of variables. More...
Public Member Functions | |
Variables (params Variable[] Variables) | |
Collection of variables. More... | |
virtual bool | TryGetVariable (string Name, out Variable Variable) |
Tries to get a variable object, given its name. More... | |
virtual bool | ContainsVariable (string Name) |
If the collection contains a variable with a given name. More... | |
virtual Variable | Add (string Name, object Value) |
Adds a variable to the collection. More... | |
virtual bool | Remove (string VariableName) |
Removes a varaiable from the collection. More... | |
virtual void | Clear () |
Removes all variables from the collection. More... | |
virtual void | Push () |
Pushes the current set of variables to the stack. This state is restored by calling Pop. Each call to this method must be followed by exactly one call to Pop. More... | |
virtual void | Pop () |
Pops a previously stored set of variables from the stack. Variables are stored on the stack by calling Push. More... | |
void | Lock () |
Locks the collection. The collection is by default thread safe. But if longer transactions require unique access, this method can be used to aquire such unique access. This works, as long as all callers that affect the corresponding state call this method also. More... | |
Task | LockAsync () |
Locks the collection. The collection is by default thread safe. But if longer transactions require unique access, this method can be used to aquire such unique access. This works, as long as all callers that affect the corresponding state call this method also. More... | |
void | Lock (int Timeout) |
Locks the collection. The collection is by default thread safe. But if longer transactions require unique access, this method can be used to aquire such unique access. This works, as long as all callers that affect the corresponding state call this method also. More... | |
async Task | LockAsync (int Timeout) |
Locks the collection. The collection is by default thread safe. But if longer transactions require unique access, this method can be used to aquire such unique access. This works, as long as all callers that affect the corresponding state call this method also. More... | |
void | Release () |
Releases the collection, previously locked through a call to Lock(). More... | |
IEnumerator< Variable > | GetEnumerator () |
Returns an enumerator that iterates through a collection. More... | |
void | CopyTo (Variables Variables) |
Copies available variables to another variable collection. More... | |
void | Abort () |
Aborts the execution of script using this collection of variables. More... | |
void | CancelAbort () |
Allows new script to be evaluated using this collection of variables. More... | |
void | Preview (Expression Expression, IElement Result) |
Reports a preview of the final result. More... | |
void | Status (Expression Expression, string Result) |
Reports current status of execution. More... | |
Protected Attributes | |
Dictionary< string, Variable > | variables = new Dictionary<string, Variable>() |
Internal set of variables. More... | |
Properties | |
object | this[string Name] [get, set] |
Access to variable values through the use of their names. More... | |
TextWriter | ConsoleOut [get, set] |
Console out interface. Can be used by functions and script to output data to the console. More... | |
IContextVariables | ContextVariables [get, set] |
Variables available during the current context. More... | |
ValuePrinter | Printer [get, set] |
Delegate that converts values to strings for (implicit) printing. Default is null, which will call the Object.ToString() method to convert the value to a string. More... | |
Variable[] | AvailableVariables [get] |
Returns an array of available variables. More... | |
bool | HandlesPreview [get] |
If previews are desired. More... | |
bool | HandlesStatus [get] |
If status messages are desired. More... | |
Events | |
PreviewEventHandler | OnPreview |
Event raised when there is a new value to preview. More... | |
StatusEventHandler | OnStatus = null |
Event raised when a status message has been reported. More... | |
Collection of variables.
Definition at line 24 of file Variables.cs.
Waher.Script.Variables.Variables | ( | params Variable[] | Variables | ) |
Collection of variables.
Definition at line 40 of file Variables.cs.
void Waher.Script.Variables.Abort | ( | ) |
Aborts the execution of script using this collection of variables.
Definition at line 415 of file Variables.cs.
|
virtual |
Adds a variable to the collection.
Name | Variable name. |
Value | Associated variable object value. |
Implements Waher.Script.IContextVariables.
Reimplemented in Waher.Script.Persistence.SQL.ObjectProperties.
Definition at line 122 of file Variables.cs.
void Waher.Script.Variables.CancelAbort | ( | ) |
Allows new script to be evaluated using this collection of variables.
Definition at line 423 of file Variables.cs.
|
virtual |
Removes all variables from the collection.
Definition at line 163 of file Variables.cs.
|
virtual |
If the collection contains a variable with a given name.
Name | Variable name. |
Implements Waher.Script.IContextVariables.
Reimplemented in TAG.Simulator.ObjectModel.Events.EventVariables, and Waher.Script.Persistence.SQL.ObjectProperties.
Definition at line 76 of file Variables.cs.
void Waher.Script.Variables.CopyTo | ( | Variables | Variables | ) |
Copies available variables to another variable collection.
Definition at line 400 of file Variables.cs.
IEnumerator< Variable > Waher.Script.Variables.GetEnumerator | ( | ) |
Returns an enumerator that iterates through a collection.
Definition at line 341 of file Variables.cs.
void Waher.Script.Variables.Lock | ( | ) |
Locks the collection. The collection is by default thread safe. But if longer transactions require unique access, this method can be used to aquire such unique access. This works, as long as all callers that affect the corresponding state call this method also.
Each successful call to this method must be followed by exacty one call to Release.
TimeoutException | If access to the collection was not granted in the alotted time |
Definition at line 252 of file Variables.cs.
void Waher.Script.Variables.Lock | ( | int | Timeout | ) |
Locks the collection. The collection is by default thread safe. But if longer transactions require unique access, this method can be used to aquire such unique access. This works, as long as all callers that affect the corresponding state call this method also.
Each successful call to this method must be followed by exacty one call to Release.
Timeout | Timeout, in milliseconds. Default timeout is 30000 milliseconds (30 s). |
TimeoutException | If access to the collection was not granted in the alotted time |
Definition at line 280 of file Variables.cs.
Task Waher.Script.Variables.LockAsync | ( | ) |
Locks the collection. The collection is by default thread safe. But if longer transactions require unique access, this method can be used to aquire such unique access. This works, as long as all callers that affect the corresponding state call this method also.
Each successful call to this method must be followed by exacty one call to Release.
TimeoutException | If access to the collection was not granted in the alotted time |
Definition at line 265 of file Variables.cs.
async Task Waher.Script.Variables.LockAsync | ( | int | Timeout | ) |
Locks the collection. The collection is by default thread safe. But if longer transactions require unique access, this method can be used to aquire such unique access. This works, as long as all callers that affect the corresponding state call this method also.
Each successful call to this method must be followed by exacty one call to Release.
Timeout | Timeout, in milliseconds. Default timeout is 30000 milliseconds (30 s). |
TimeoutException | If access to the collection was not granted in the alotted time |
Definition at line 294 of file Variables.cs.
|
virtual |
Pops a previously stored set of variables from the stack. Variables are stored on the stack by calling Push.
Definition at line 202 of file Variables.cs.
void Waher.Script.Variables.Preview | ( | Expression | Expression, |
IElement | Result | ||
) |
Reports a preview of the final result.
Expression | Expression being executed. |
Result | Preview |
Definition at line 455 of file Variables.cs.
|
virtual |
Pushes the current set of variables to the stack. This state is restored by calling Pop. Each call to this method must be followed by exactly one call to Pop.
Definition at line 180 of file Variables.cs.
void Waher.Script.Variables.Release | ( | ) |
Releases the collection, previously locked through a call to Lock().
Definition at line 308 of file Variables.cs.
|
virtual |
Removes a varaiable from the collection.
VariableName | Name of variable. |
Reimplemented in TAG.Simulator.ObjectModel.Events.EventVariables.
Definition at line 147 of file Variables.cs.
void Waher.Script.Variables.Status | ( | Expression | Expression, |
string | Result | ||
) |
Reports current status of execution.
Expression | Expression. |
Result | Status Message |
Definition at line 481 of file Variables.cs.
Tries to get a variable object, given its name.
Implements Waher.Script.IContextVariables.
Reimplemented in Waher.Script.Persistence.SQL.ObjectProperties.
Definition at line 52 of file Variables.cs.
|
protected |
Internal set of variables.
Definition at line 29 of file Variables.cs.
|
get |
Returns an array of available variables.
Definition at line 316 of file Variables.cs.
|
getset |
Console out interface. Can be used by functions and script to output data to the console.
Definition at line 218 of file Variables.cs.
|
getset |
Variables available during the current context.
Definition at line 227 of file Variables.cs.
|
get |
If previews are desired.
Definition at line 436 of file Variables.cs.
|
get |
If status messages are desired.
Definition at line 500 of file Variables.cs.
|
getset |
Delegate that converts values to strings for (implicit) printing. Default is null, which will call the Object.ToString() method to convert the value to a string.
Definition at line 237 of file Variables.cs.
|
getset |
Access to variable values through the use of their names.
Name | Variable name. |
Definition at line 100 of file Variables.cs.
PreviewEventHandler Waher.Script.Variables.OnPreview |
Event raised when there is a new value to preview.
Definition at line 431 of file Variables.cs.
StatusEventHandler Waher.Script.Variables.OnStatus = null |
Event raised when a status message has been reported.
Definition at line 508 of file Variables.cs.