Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Waher.Script.Variables Class Reference

Collection of variables. More...

Inheritance diagram for Waher.Script.Variables:
Waher.Script.IContextVariables TAG.Simulator.ObjectModel.Events.EventVariables Waher.Networking.HTTP.SessionVariables Waher.Networking.HTTP.SessionVariables Waher.Script.Persistence.SQL.ObjectProperties Waher.Security.WAF.Model.RequestVariables

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...
 
IEnumerator< VariableGetEnumerator ()
 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...
 
async Task Preview (Expression Expression, IElement Result)
 Reports a preview of the final result. More...
 
async Task Status (Expression Expression, string Result)
 Reports current status of execution. More...
 

Protected Attributes

Dictionary< string, Variablevariables = 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 Aborted [get]
 If the script has been aborted. More...
 
bool Active [get]
 If script is still active (i.e. has not been aborted). More...
 
bool HandlesPreview [get]
 If previews are desired. More...
 
bool HandlesStatus [get]
 If status messages are desired. More...
 
CancellationToken CancellationToken [get]
 Cancellation token, that can be used to monitor for script abortion. More...
 

Events

EventHandlerAsync< PreviewEventArgsOnPreview
 Event raised when there is a new value to preview. More...
 
EventHandlerAsync< StatusEventArgsOnStatus = null
 Event raised when a status message has been reported. More...
 

Detailed Description

Collection of variables.

Definition at line 24 of file Variables.cs.

Constructor & Destructor Documentation

◆ Variables()

Waher.Script.Variables.Variables ( params Variable[]  Variables)

Collection of variables.

Definition at line 41 of file Variables.cs.

Member Function Documentation

◆ Abort()

void Waher.Script.Variables.Abort ( )

Aborts the execution of script using this collection of variables.

Definition at line 349 of file Variables.cs.

◆ Add()

virtual Variable Waher.Script.Variables.Add ( string  Name,
object  Value 
)
virtual

Adds a variable to the collection.

Parameters
NameVariable name.
ValueAssociated variable object value.
Returns
Reference to variable that was added.

Implements Waher.Script.IContextVariables.

Reimplemented in Waher.Script.Persistence.SQL.ObjectProperties.

Definition at line 126 of file Variables.cs.

◆ CancelAbort()

void Waher.Script.Variables.CancelAbort ( )

Allows new script to be evaluated using this collection of variables.

Definition at line 361 of file Variables.cs.

◆ Clear()

virtual void Waher.Script.Variables.Clear ( )
virtual

Removes all variables from the collection.

Definition at line 167 of file Variables.cs.

◆ ContainsVariable()

virtual bool Waher.Script.Variables.ContainsVariable ( string  Name)
virtual

If the collection contains a variable with a given name.

Parameters
NameVariable name.
Returns
If a variable with that name exists.

Implements Waher.Script.IContextVariables.

Reimplemented in TAG.Simulator.ObjectModel.Events.EventVariables, Waher.Networking.HTTP.SessionVariables, Waher.Networking.HTTP.SessionVariables, Waher.Script.Persistence.SQL.ObjectProperties, and Waher.Security.WAF.Model.RequestVariables.

Definition at line 80 of file Variables.cs.

◆ CopyTo()

void Waher.Script.Variables.CopyTo ( Variables  Variables)

Copies available variables to another variable collection.

Parameters
VariablesVariable collection to copy variables to.

Definition at line 334 of file Variables.cs.

◆ GetEnumerator()

IEnumerator< Variable > Waher.Script.Variables.GetEnumerator ( )

Returns an enumerator that iterates through a collection.

Returns
Enumerator object.

Definition at line 275 of file Variables.cs.

◆ Pop()

virtual void Waher.Script.Variables.Pop ( )
virtual

Pops a previously stored set of variables from the stack. Variables are stored on the stack by calling Push.

Definition at line 206 of file Variables.cs.

◆ Preview()

async Task Waher.Script.Variables.Preview ( Expression  Expression,
IElement  Result 
)

Reports a preview of the final result.

Parameters
ExpressionExpression being executed.
ResultPreview

Definition at line 407 of file Variables.cs.

◆ Push()

virtual void Waher.Script.Variables.Push ( )
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 184 of file Variables.cs.

◆ Remove()

virtual bool Waher.Script.Variables.Remove ( string  VariableName)
virtual

Removes a varaiable from the collection.

Parameters
VariableNameName of variable.
Returns
If the variable was found and removed.

Reimplemented in TAG.Simulator.ObjectModel.Events.EventVariables.

Definition at line 151 of file Variables.cs.

◆ Status()

async Task Waher.Script.Variables.Status ( Expression  Expression,
string  Result 
)

Reports current status of execution.

Parameters
ExpressionExpression.
ResultStatus Message

Definition at line 424 of file Variables.cs.

◆ TryGetVariable()

virtual bool Waher.Script.Variables.TryGetVariable ( string  Name,
out Variable Variable   
)
virtual

Tries to get a variable object, given its name.

Parameters
NameVariable name.
VariableVariable, if found, or null otherwise.
Returns
If a variable with the corresponding name was found.

Implements Waher.Script.IContextVariables.

Reimplemented in Waher.Networking.HTTP.SessionVariables, Waher.Networking.HTTP.SessionVariables, Waher.Script.Persistence.SQL.ObjectProperties, and Waher.Security.WAF.Model.RequestVariables.

Definition at line 56 of file Variables.cs.

Member Data Documentation

◆ variables

Dictionary<string, Variable> Waher.Script.Variables.variables = new Dictionary<string, Variable>()
protected

Internal set of variables.

Definition at line 29 of file Variables.cs.

Property Documentation

◆ Aborted

bool Waher.Script.Variables.Aborted
get

If the script has been aborted.

Definition at line 373 of file Variables.cs.

◆ Active

bool Waher.Script.Variables.Active
get

If script is still active (i.e. has not been aborted).

Definition at line 378 of file Variables.cs.

◆ AvailableVariables

Variable [] Waher.Script.Variables.AvailableVariables
get

Returns an array of available variables.

Definition at line 250 of file Variables.cs.

◆ CancellationToken

CancellationToken Waher.Script.Variables.CancellationToken
get

Cancellation token, that can be used to monitor for script abortion.

Definition at line 444 of file Variables.cs.

◆ ConsoleOut

TextWriter Waher.Script.Variables.ConsoleOut
getset

Console out interface. Can be used by functions and script to output data to the console.

Definition at line 222 of file Variables.cs.

◆ ContextVariables

IContextVariables Waher.Script.Variables.ContextVariables
getset

Variables available during the current context.

Definition at line 231 of file Variables.cs.

◆ HandlesPreview

bool Waher.Script.Variables.HandlesPreview
get

If previews are desired.

Definition at line 388 of file Variables.cs.

◆ HandlesStatus

bool Waher.Script.Variables.HandlesStatus
get

If status messages are desired.

Definition at line 434 of file Variables.cs.

◆ Printer

ValuePrinter Waher.Script.Variables.Printer
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 241 of file Variables.cs.

◆ this[string Name]

object Waher.Script.Variables.this[string Name]
getset

Access to variable values through the use of their names.

Parameters
NameVariable name.
Returns
Associated variable object value.

Definition at line 104 of file Variables.cs.

Event Documentation

◆ OnPreview

EventHandlerAsync<PreviewEventArgs> Waher.Script.Variables.OnPreview

Event raised when there is a new value to preview.

Definition at line 383 of file Variables.cs.

◆ OnStatus

EventHandlerAsync<StatusEventArgs> Waher.Script.Variables.OnStatus = null

Event raised when a status message has been reported.

Definition at line 439 of file Variables.cs.


The documentation for this class was generated from the following file: