IStartToken
- Namespace
- ZCore
- Extends
- Inherited Properties
- Inherited Methods
INTERFACE IStartToken EXTENDS ZCore.IError
Implementing this interface allows the user to externally abort the implementing object. For details see StartToken.
Properties
MonitorExecution
PROPERTY MonitorExecution : BOOL
This property indicates if an object, which gets this Token in an async method call, whether it shall be stored to monitor the whole execution of the task or not. In case the execution shall be monitored (property=TRUE), the object can inform this Token as the caller of an originally started task, if it has changed unexpected, with aborting the Token.
For example you can think of an axis starting MoveAbsoluteAsync in a sequence. Stopping the axis at a different place in your application without or with another Token leads to aborting the stored Token, therefore, the caller gets informed about the change.
Tokens with this property being TRUE are the ExecutionToken and a Sequence.
To 'only' ask if an async call was executed successfully, use the StartToken
Property Value
- BOOL
Methods
Abort
METHOD Abort (
[input] message : ZString)
This method should be called in an actual implementation of a framework object if an error occcured during executing a sequence. The method changes the state of the object to error and additionally, sets a message to indicate the problem. The error source of the issue is set to THIS^ object and the error code is set to 0. If the error should be more specific and be externally evaluated with the ErrorId method, AbortErrorId should be used instead.
If called during initialization (state_ = Booting) the state variable is set to BootingError.
Note
For pure Objects the abort method is not callable from the outside, because its abort method is PROTECTED. The StartToken, however, make the method available from the outside API.
Inputs
messageZString
AbortErrorId
METHOD AbortErrorId (
[input] errorId : UDINT,
[input] message : ZString)
This method should be called in an actual implementation of a framework object if an error occcured during executing a sequence. The method changes the internal state of the object to error and additionally, sets a message to indicate the problem. The error source of the issue is set to THIS^ object and the error code is set to errorId.
If called during initialization (state_ = Booting) the state variable is set to BootingError.
Note
For pure Objects the abort method is not callable from the outside, because its abort method is PROTECTED. The StartToken, however, make the method available from the outside API.
Inputs
errorIdUDINTmessageZString
AbortWithContext
METHOD AbortWithContext (
[input] message : ZString,
[input] context : REFERENCE TO ManagedObject)
This method should be called in an actual implementation of a framework object if an error occcured during executing a sequence. The method changes the internal state of the object to error and additionally, sets a message to indicate the problem. The error source of the issue is set to THIS^ object and the error code is set to errorId.
If called during initialization (state_ = Booting) the state variable is set to BootingError.
Note
For pure Objects the abort method is not callable from the outside, because its abort method is PROTECTED. The StartToken, however, make the method available from the outside API.
If the optional context parameter is provided, error tracing is more detailed
Inputs
messageZStringcontextREFERENCE TO ManagedObject
Assert
METHOD Assert (
[input] obj : IError) : BOOL
This method is used for error propagation from one object obj to this object. The error state of this object is set if it is not already in error state and obj has an error. The error source is set to obj, such that for hierarchies the initial error source can be specified by recursion (see ErrorSource).
Note
For pure Objects the abort method is not callable from the outside, because its abort method is PROTECTED. The StartToken, however, make the method available from the outside API.
Inputs
objIError
Returns
- BOOL
AssertCondition
METHOD AssertCondition (
[input] condition : BOOL,
[input] message : ZString) : BOOL
This method evaluates a condition. If the condition is not satisfied, a call to AbortErrorId is made, which puts the object into its error state, setting the error source to THIS^.
IF NOT condition
THEN
AbortErrorId(0, ErrorMessage);
END_IF
The condition check is meant to be similar to other programming languages, e.g. assert in C++.
Note
For pure Objects the abort method is not callable from the outside, because its abort method is PROTECTED. The StartToken, however, make the method available from the outside API.
Inputs
conditionBOOLmessageZString
Returns
- BOOL