IStartToken
- Namespace
- ZCore
Implementing this interface allows the user to externally abort the implementing object. For details see StartToken.
INTERFACE IStartToken EXTENDS ZCore.IError
- Extends
- Inherited Properties
- Inherited Methods
Properties
MonitorExecution
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 MonitorExecution : BOOL
Property Value
- BOOL
Methods
Abort
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.
METHOD Abort (
message : ZString)
Inputs
message
ZString
AbortErrorId
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.
METHOD AbortErrorId (
errorId : UDINT,
message : ZString)
Inputs
errorId
UDINTmessage
ZString
AbortWithContext
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
METHOD AbortWithContext (
message : ZString,
context : REFERENCE TO ManagedObject)
Inputs
message
ZStringcontext
REFERENCE TO ManagedObject
Assert
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.
METHOD Assert (
obj : IError) : BOOL
Inputs
obj
IError
Returns
- BOOL
AssertCondition
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.
METHOD AssertCondition (
condition : BOOL,
message : ZString) : BOOL
Inputs
condition
BOOLmessage
ZString
Returns
- BOOL