3ds Max C++ API Reference
Loading...
Searching...
No Matches
DefaultRemapDir Class Reference

Implements a default version of a RemapDir. More...

#include <ref.h>

+ Inheritance diagram for DefaultRemapDir:

Public Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 

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.

Constructor & Destructor Documentation

◆ DefaultRemapDir()

CoreExport DefaultRemapDir ( BOOL  use_A_WORK2_flag = FALSE)

◆ ~DefaultRemapDir()

Member Function Documentation

◆ FindMapping()

RefTargetHandle FindMapping ( RefTargetHandle  from)
overridevirtual

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

Parameters
from- This is the item to see if cloned.
Returns
A pointer to the clone of the item, NULL if not cloned

Implements RemapDir.

◆ AddEntry()

void AddEntry ( RefTargetHandle  hfrom,
RefTargetHandle  hto 
)
overridevirtual

Registers a mapping of original object to clone.

Implements RemapDir.

◆ PatchPointer()

void PatchPointer ( RefTargetHandle patchThis,
RefTargetHandle  oldTarg 
)
overridevirtual

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.

◆ Backpatch()

void Backpatch ( )
overridevirtual

Runs back patch procedures and PostPatchProcs.

Implements RemapDir.

◆ BackpatchPending()

bool BackpatchPending ( )
overridevirtual

Used internally.

Implements RemapDir.

◆ Clear()

void Clear ( )
overridevirtual

Used internally.

Implements RemapDir.

◆ ClearBackpatch()

void ClearBackpatch ( )
overridevirtual

Used internally.

Implements RemapDir.

◆ DeleteThis()

void DeleteThis ( )
overridevirtual

Used internally.

Implements RemapDir.

◆ AddPostPatchProc()

void AddPostPatchProc ( PostPatchProc proc,
bool  toDelete 
)
overridevirtual

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.