Table of Contents

ObjectManager

Namespace
ZAux
Implements
FUNCTION_BLOCK ObjectManager IMPLEMENTS ZCore.IObject, ZCore.IBootable, ZCore.IError

This function block manages a list of IManagedObject and calls their Cyclic methods in a given interval (usually the PLC-taskcycle). The maximum amount of these objects handled by this class is given by MaxObjectManagerObjectCount

Objects, whose cyclic method should be called by this class, can be added using the AddObject method. Internally the function block stores interfaces to these objects. Objects should only be handled with the IObject within the framework and this class is the main exception to this rule, because it has to call the Cyclic method of an IManagedObject without the object having to implement IManagedObject.

Properties

Booted

PROPERTY Booted : BOOL

Property Value

BOOL

BootingHints

PROPERTY BootingHints : ZCore.ManagedObjectBootingHintFlags

Suggests when the Cyclic method should be called during the booting phase of the application

Property Value

ManagedObjectBootingHintFlags

Busy

PROPERTY Busy : BOOL

If any object that has been added to the ObjectManager by calling AddObject is in one of the following busy states (Busy or Booting, this property returns TRUE.

Note that this property not only returns a flag, but also retrieves the busy state by iterating through all object registered with this object manager instance.

Property Value

BOOL

Done

PROPERTY Done : BOOL

If all objects that have been added to the ObjectManager by calling AddObject are not busy and are not in an error state, this property returns TRUE.

Note that this property not only returns a flag, but also retrieves the error cause by iterating through all object registered with this object manager instance.

Property Value

BOOL

Error

PROPERTY Error : BOOL

If any object that has been added to the ObjectManager by calling AddObject is in an error state (Error or BootingError this property returns TRUE. The error information of the first object that is in an error state can be retrieved by the ErrorMessage method.

Note that this property not only returns a flag, but also retrieves the error cause by iterating through all object registered with this object manager instance.

Property Value

BOOL

Methods

AddObject

METHOD AddObject (
 [input] object : ZCore.IManagedObject) : BOOL

Adds an object to the ObjectManager list of cyclically to be called objects. This method returns true if an IManagedObject was added successfully. Otherwise the method returns false. The later occurs in the following cases:

  • the object interface is invalid
  • the internal list is full, in this case it might be necessary to adjust MaxObjectManagerObjectCount or use an additional ObjectManager instance
  • this particular object has already been added

Inputs

object IManagedObject

Returns

BOOL

Cyclic

METHOD Cyclic ()

This method calls the Cyclic methods of all IManagedObject that have been added to this ObjectManager using AddObject

ErrorId

METHOD ErrorId () : UDINT

When the object Aborts the execution, the provided error id can be returned by calling this method; if the object was aborted by Assert() the errorId of the failure causing object is returned instead.

Returns

UDINT

ErrorMessage

METHOD ErrorMessage () : ZCore.ZString

This method returns an error messages that caused a fault in the object. The message that is returned by this method is only valid, if the object is in an error state (Error or BootingError, respectively). Notice that this method returns a string by value such that the internal message is copied.

Messages that are set at one point will not be cleared, because this could effect performance negatively.

Returns

ZString

ErrorSource

METHOD ErrorSource () : ZCore.IError

Returns the object that was the failure cause for this object to abort. This object gets automatically set when calling any of the abort methods. If the object itself is the failure cause, THIS^ is returned.

The object returned by this method is never 0, even if no error is present, use it in combination with a Error property.

Returns

IError

TraceErrorStack

METHOD TraceErrorStack (
 [input] trace : ZCore.IErrorTrace)

This method is used internally when recording an error trace.

Inputs

trace IErrorTrace