2using System.Threading.Tasks;
69 public override Task
Parse(XmlElement Xml)
74 return base.Parse(Xml);
84 if (this.actionRef.
IsConstant && !
this.actionRef.IsEmpty && !Machine.
TryGetAction(
this.actionRef.Definition, out
_))
87 base.CheckReferences(Machine,
Token);
97 return this.actionRef?.
Evaluate(Arguments.
Variables) ?? Task.FromResult<
string>(
null);
109 if (
string.IsNullOrEmpty(ActionId))
110 return TimeSpan.Zero;
112 DateTime Start = DateTime.UtcNow;
113 await this.
ExecuteNoLog(ActionId, Arguments, SuppressSample);
114 TimeSpan Elapsed = DateTime.UtcNow.Subtract(Start);
127 ArchiveRequired = Arguments.Machine.ArchiveRequired
141 await this.
ExecuteNoLog(ActionId, Arguments, SuppressProfiling);
152 if (!
string.IsNullOrEmpty(ActionId))
162 if (this.beforeActionScript?.HasExpreession ??
false)
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
ProfilerThread GetThread(string Name, ProfilerThreadType Type)
Gets a profiler thread. If none is available, a new is created.
Class that keeps track of events and timing for one thread.
void Low()
Sets the (binary) state to "low".
void High()
Sets the (binary) state to "high".
Exception related to state machine.
override async Task Execute(EvaluationArguments Arguments)
Evaluates the action node
Represents an action definition.
Abstract base class for nodes referencing an action.
string BeforeActionScript
Script executed before action.
bool HasActionReference
If event has an action reference.
async Task ExecuteNoLog(EvaluationArguments Arguments, bool SuppressProfiling)
Evaluates an action, without logging the time the action took as a sample value.
override Task Parse(XmlElement Xml)
Parses the State-machine node.
ActionReference()
Abstract base class for nodes referencing an action.
string ActionReferenceDefinition
Action Reference
bool HasExpressionActionReference
If event has an action reference defined in an expression.
Task< string > GetReference(EvaluationArguments Arguments)
Evaluates the reference.
override void CheckReferences(StateMachine Machine, Token Token)
Checks references in the node.
async Task ExecuteNoLog(string ActionId, EvaluationArguments Arguments, bool SuppressProfiling)
Evaluates an action, without logging the time the action took as a sample value.
async Task< TimeSpan > ExecuteLog(EvaluationArguments Arguments, bool SuppressSample)
Evaluates an action, and logs the time the action took as a sample value.
bool HasConstantActionReference
If event has a constant action reference.
Attribute containing a script expression.
async Task< object > Evaluate(Variables Variables)
Evaluates the attribute
string Expression
Expression
bool IsEmpty
If the definition is empty.
bool IsExpression
If the attribute value is an expression.
async Task< T > Evaluate(Variables Variables)
Evaluates the attribute
bool IsConstant
If the attribute value is a constant.
string Definition
Attribute definition
Scriptable string attribute.
Contains information required for evaluating script in a state-machine.
StateMachine Machine
Reference to state-machine definition.
Profiler Profiler
State-Machine profiler.
Variables Variables
Current set of variables.
Abstract base class for State-Machine nodes.
Variable definition in a State-Machine
Class representing a state machine.
bool TryGetAction(string Id, out Model.Actions.Action Action)
Tries to get an action.
CaseInsensitiveString StateMachineId
ID of State Machine.
Duration? ArchiveOptional
Duration after which token expires, and the required archiving time, the token can optionally be arch...
DateTime Expires
When state-machine expires
Class representing a sample of a state machine variable over time.
ProfilerThreadType
Type of profiler thread.