The OdRxObject class provides the ability to copy Rx instances:
- Copying the content of an instance — Copies whole content or part of the content from one
instance into another instance, which gives the ability to initialize an
instance using other instance as a pattern. Use the CopyFrom() method, which requires the raw
pointer to the source instance as an argument, does not
return a value, and copies its content.
- Cloning an instance — Creates a new instance that is the
duplicate of an existing instance. The duplicate will have the same
content, but it will differ by reference counter data. Use the clone()
method, which does not require arguments and returns the non-typified smart
pointer to the duplicate. The clone() method calls the copyFrom() method to
initialize the new instance.
The CopyFrom() and clone() methods are virtual and developers can redefine
them in their own derived classes. The clone() method uses the copyFrom() virtual method
that must be defined beforehand. When the copyFrom() method is undefined, the clone() method throws
the exception: «This application has requested the Runtime to terminate it in an unusual way.»
For more details, see the following topics:
Copying the Content of Rx Objects
Cloning Rx Objects
Redefining the Clone Method of Rx Objects
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|
|