IIndirectReferenceMaker Class Reference

IIndirectReferenceMaker Class Referenceabstract

#include <IIndirectRefMaker.h>

Class Description

The interface for an object to specify the ReferenceTargets it is dependent on, but doesn't hold a reference to (i.e., indirect references).

The owner of a RefTargMonitorRefMaker-like instance would implement this interface to cause the ReferenceTargets it is dependent on, but doesn't hold a reference to, to be saved when the owner is saved, and loaded when the owner is loaded. When the scene is loaded, SetIndirectReference is called to set the indirect reference.

Indirect references should typically implemented as weak references. Otherwise, if ref A holds a normal reference to B, and B holds an indirect reference to A, A would never be deleted because there is always at least one strong reference to it.

For an example, see the NodeTransformMonitor class in maxsdk\samples\controllers\nodetransformmonitor.cpp.

See also
RefTargMonitorRefMaker.
+ Inheritance diagram for IIndirectReferenceMaker:

Public Member Functions

virtual int NumIndirectRefs ()=0
 The number of indirect references. More...
 
virtual RefTargetHandle GetIndirectReference (int i)=0
 Retrieve the indexed indirect reference. More...
 
virtual void SetIndirectReference (int i, RefTargetHandle rtarg)=0
 Set the indexed indirect reference. More...
 
virtual int RemapIndirectRefOnLoad (int iref)
 Specifies remapping of indirect references on load. More...
 
virtual BOOL ShouldPersistIndirectRef (RefTargetHandle rtarg)
 Specifies whether an indirect reference is persisted on a partial load or save. More...
 

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Member Function Documentation

virtual int NumIndirectRefs ( )
pure virtual

The number of indirect references.

Returns
The number of indirect references.
virtual RefTargetHandle GetIndirectReference ( int  i)
pure virtual

Retrieve the indexed indirect reference.

Parameters
i- The virtual array index of the indirect reference to get.
Returns
The reference handle of the 'i-th' indirect reference.
virtual void SetIndirectReference ( int  i,
RefTargetHandle  rtarg 
)
pure virtual

Set the indexed indirect reference.

Parameters
i- The virtual array index of the indirect reference to set.
rtarg- The indirect reference.
virtual int RemapIndirectRefOnLoad ( int  iref)
inlinevirtual

Specifies remapping of indirect references on load.

This method is used when you have modified a IIndirectReferenceMaker to add or delete indirect references, and are loading old files. This method is called during the reference mapping process, after the Load() method is called. You determine what version is loading in the Load(), and store the version in a variable which you can look at in RemapIndirectRefOnLoad() to determine how to remap indirect references. The default implementation of this method just returns the same value it is passed, so you don't need to implement it unless you have added or deleted indirect references from your class.

Parameters
iref- The input index of the indirect reference.
Returns
The output index of the indirect reference.
59 { return iref; }
virtual BOOL ShouldPersistIndirectRef ( RefTargetHandle  rtarg)
inlinevirtual

Specifies whether an indirect reference is persisted on a partial load or save.

This method specifies the partial load/save behavior of an indirect reference. If this method returns true, and the ref maker implementing this interface is loaded/saved, the indirect reference will be forced to be loaded/saved. If false, the indirect reference will not be forced to be loaded/saved, but will be hooked back up if it is loaded.

Since indirect references are typically implemented as weak references, the default implementation of this method is to return false. Typical cases where an implementation of this method would return true is if the indirect reference is to a node (such as in NodeTransformMonitor) or postload callbacks are used to check and process the indirect reference.

Parameters
rtarg- The indirect reference.
Returns
Whether to force the load/save of the indirect reference if the implementing reference maker is saved.
73 { UNUSED_PARAM(rtarg); return FALSE; }
#define UNUSED_PARAM(x)
Definition: BuildWarnings.h:18