Public Member Functions

DefaultRemapDir Class Reference

This reference page is linked to from the following overview topics: NoRemap() was Deprecated.


Search for all occurrences

Detailed Description

Implements a default version of a RemapDir.

See also:
CloneRefHierarchy(), ReferenceTarget::Clone() Instances of this class are used as the default argument to the ReferenceTarget::Clone method. When the boolean use_A_WORK2_flag is set to TRUE, the remap directory will set this flag on all entries in the remap directory, and will assume that any object that DOESN'T have this flag set is not in the remap directory. This avoids the search through the directory and speeds up things greatly. When using this feature, you must first clear A_WORK2 on all of the objects being cloned. DS: 3/17/00. When the instance is deleted, the Backpatch() method is automatically called if backpatch operations were added but never performed.
Precondition:
First clear the A_WORK2 flag on all objects being cloned.
Postcondition:
Flag is set on all entries in remap directory.
Parameters:
use_A_WORK2_flag - used to set this flag on all entries in the remap directory.

#include <ref.h>

Inheritance diagram for DefaultRemapDir:
Inheritance graph
[legend]

List of all members.

Public Member Functions

CoreExport  DefaultRemapDir (BOOL use_A_WORK2_flag=FALSE)
CoreExport  ~DefaultRemapDir ()
RefTargetHandle  FindMapping (RefTargetHandle from)
  Returns a pointer to a target's clone if it was cloned or NULL otherwise.
void  AddEntry (RefTargetHandle hfrom, RefTargetHandle hto)
  Registers a mapping of original object to clone.
void  PatchPointer (RefTargetHandle *patchThis, RefTargetHandle oldTarg)
  This method is used to back patch the pointer for cloned items.
void  Backpatch ()
  Runs back patch procedures and PostPatchProcs.
bool  BackpatchPending ()
  Used internally.
void  Clear ()
  Used internally.
void  ClearBackpatch ()
  Used internally.
void  DeleteThis ()
  Used internally.
void  AddPostPatchProc (PostPatchProc *proc, bool toDelete)
  Adds a Procedure that is called after cloning and back patching.

Constructor & Destructor Documentation

CoreExport DefaultRemapDir ( BOOL  use_A_WORK2_flag = FALSE )
CoreExport ~DefaultRemapDir ( )

Member Function Documentation

RefTargetHandle FindMapping ( RefTargetHandle  from ) [virtual]

Returns a pointer to a target's clone if it was cloned or NULL otherwise.

Implements RemapDir.

void AddEntry ( RefTargetHandle  hfrom,
RefTargetHandle  hto 
) [virtual]

Registers a mapping of original object to clone.

Implements RemapDir.

void PatchPointer ( RefTargetHandle patchThis,
RefTargetHandle  oldTarg 
) [virtual]

This method is used to back patch the pointer for cloned items.

If oldTarg has already been cloned, then the RefTargetHandle variable pointed to by patchThis is set to the pointer of the clone. If oldTarg has not been cloned, a back patch procedure is registered that is run after all cloning is completed but before the PostPatchProcs are run. The back patch procedure checks to see if oldTarg has been cloned, and if so the the RefTargetHandle variable pointed to by patchThis is set to the pointer of the clone. If oldTarg has not been cloned, the RefTargetHandle variable pointed to by patchThis is set to oldTarg. Because there may be a delayed write to the RefTargetHandle variable, this variable should not be a stack variable. Note that this method is primarily used when an object being cloned holds a raw pointer to a ReferenceTarget (i.e., it does not hold a reference to the ReferenceTarget). In general, this is not safe due to the potential for a dangling pointer when that ReferenceTarget is deleted. It is better to use a SingleRefMaker or a SingleWeakRefMaker member variable to hold the pointer as it will hold a reference to the ReferenceTarget and properly NULL the pointer when/if the ReferenceTarget is deleted.

See also:
SingleRefMaker, SingleWeakRefMaker
Parameters:
patchThis - The RefTargetHandle variable to be set.
oldTarg - The original target.

Implements RemapDir.

void Backpatch ( ) [virtual]

Runs back patch procedures and PostPatchProcs.

Implements RemapDir.

bool BackpatchPending ( ) [virtual]

Used internally.

Implements RemapDir.

void Clear ( ) [virtual]

Used internally.

Implements RemapDir.

void ClearBackpatch ( ) [virtual]

Used internally.

Implements RemapDir.

void DeleteThis ( ) [virtual]

Used internally.

Implements RemapDir.

void AddPostPatchProc ( PostPatchProc proc,
bool  toDelete 
) [virtual]

Adds a Procedure that is called after cloning and back patching.

This method is used for adding a PostPatchProc whose procedure method is called after the reference hierarchy has been cloned and any back patching has occurred. These will be called in the order that they are registered. The PostPatchProc procs are called from the RemapDirImp::Backpatch(). More information can be found at the RefTargMonitorRefMaker::Proc method. See NodeMonitor::Clone for an example.

Parameters:
proc - Points to the callback object.
toDelete - If true, the callback object is deleted when the RemapDir is deleted.

Implements RemapDir.


DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir
DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir DefaultRemapDir