WeakClone
TheWeakClonemethod ensures that, if the specified object is cloned, weak persistent references to it are maintained.
ODID WeakClone (in ODDraftKey key, in ODID objectID, in ODID toObjectID, in ODID scope);
key- The draft key of the current cloning transaction.
objectID- The ID of the persistent object or storage unit to be weakly cloned.
toObjectID- The ID of the destination persistent object or storage unit, or
kODNULLIDto create a new storage unit in this draft.scope- The ID of the frame that defines the scope of this cloning operation.
- return value
- The ID of the duplicated persistent object or storage unit.
DISCUSSION
This method is called by theCloneIntomethod of persistent objects. You can call this method from your part'sCloneIntomethod if your part has weak persistent references to other objects.The
keyparameter is the draft key of the current cloning transaction, which was returned by a call to this draft object'sBeginClonemethod and passed to the calling object'sCloneIntomethod.The
objectIDparameter is the ID of an object to be weakly cloned because the calling object has a weak persistent reference to it. TheWeakClonemethod does not guarantee that the specified object will be copied, but if the object is copied because of an existing strong persistent reference to it, the calling object's weak persistent references will be maintained across the cloning transaction.The
toObjectIDparameter specifies the ID of the destination storage unit. If thetoObjectIDparameter is null, a new destination storage unit is created in this destination draft, if necessary.If the object being weakly cloned has persistent references to other objects, the
scopeparameter determines which of the referenced objects are within the scope of this cloning operation. Usually thescopeparameter is the ID of a frame, and only those objects embedded in that frame are within scope. In the rare case in which thescopeparameter iskODIDAll, all referenced objects are within scope.You must not use the returned ID until the end of the current cloning transaction. Furthermore, before you try to access the persistent object or storage unit with the corresponding ID, you must call the
IsValidIDmethod to verify that the ID is still valid.EXCEPTIONS
kODErrInvalidID- The
toObjectIDparameter did not specify a valid destination object or storage unit.SEE ALSO
TheODDraftKeytype (page 902).
TheODIDtype (page 899).
TheODDraft::AbortClonemethod (page 151).
TheODDraft::BeginClonemethod (page 159).
TheODDraft::Clonemethod (page 162).
TheODDraft::EndClonemethod (page 171).
TheODDraft::IsValidIDmethod (page 175).
TheODPersistentObject::CloneIntomethod (page 557).
TheODStorageUnit::CloneIntomethod (page 673).
Listing 2-43 on page 103 in OpenDoc Cookbook.
Listing 2-47 on page 110 in OpenDoc Cookbook.
"Clone" on page 323 in OpenDoc Programmer's Guide.
"The CloneInto Method of Your Part Editor" on page 327 in OpenDoc Programmer's Guide.