|
ACIS provides class copy constructors, class methods, and functions for copying objects. A copy of an object may be a deep copy or a shallow copy.
|
|
|
A deep copy is a copy made by replicating the object plus any assets owned by the object, including objects pointed at by data members of the object being copied. The copied item does not share any data with the original. A deep copy allocates new storage for all member data and any pointers, so that all the information about that item is self-contained in its own memory block.
|
|
|
A shallow copy copies an object, but instead of copying all the other objects it references (a deep copy) it references the same objects that the original uses. A shallow copy stores only the first instance of the item in memory, and increments a reference count for each copy.
|
|
|
For a copy of an entity that does not share underlying information with the original, a deep copy should be used. One reason for using a deep copy of an entity is to move the deep copy into a different history stream, breaking all ties with the previous history stream. A call to
api_deep_copy_entity is used to create the deep copy. There are some entities that are can not be deep copied (by design). If such entities are present during a deep copy, a
sys_error will be thrown. A flag can be passed into the API if attributes that can't be deep copied need to be skipped over when doing a deep copy. Any non-attribute entities that cannot be deep copied will throw a
sys_error regardless of the logical flag setting.
|