deepClone
Short summary
This method is used to create a new instance of the object which has the same internal state as the object. If the object is a container class, the references to the content objects are cloned too.
If an object does not support cloning the return value is
CNM_ReturnTypes.CloneResult.CLONE_IS_NOT_SUPPORTED.
If there is not enough memory or the cloning fails because the
attribute enable dynamic creation was forgotten the return value is
CNM_ReturnTypes.CloneResult.FAILED.
If something goes wrong, then this method must clean up everything
that has been cloned and free the memory again.
The deepClone either works completely, or not at all
Only if the return value is CNM_ReturnTypes.CloneResult.SUCCESS
the output clonedObject points to the new object
otherwise clonedObject is NULL.
Return:CNM_ReturnTypes.CloneResult.SUCCESS: new object clone was created,
CNM_ReturnTypes.CloneResult.FAILED: object clone failed
CNM_ReturnTypes.CloneResult.CLONE_IS_NOT_SUPPORTED: object does not support deep cloning
- Return type: CNM_ReturnTypes.CloneResult
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| clonedObject | IObject | new object instance or NULL if somthing went wrong | output |
Code
Declaration
METHOD deepClone :CNM_ReturnTypes.CloneResult
VAR_OUTPUT
(* new object instance or NULL if somthing went wrong *)
clonedObject :IObject;
END_VAR