Public Member Functions | Protected Member Functions

RefTargMonitorRefMaker Class Reference

Search for all occurrences

Detailed Description

Defines a class for monitoring a ReferenceTarget.

Defines a class for monitoring a ReferenceTarget by holding a weak reference to it (IsRealDependency returns false) and passing NotifyRefChanged messages to the owner of the class instance. The owner would create an instance of this class passing itself as the owner and the ReferenceTarget to watch as the target. The owner must derive from IRefTargMonitor, and would typically derive from IIndirectReferenceMaker. If the owner derives from IIndirectReferenceMaker, during scene load IIndirectReferenceMaker::SetIndirectReference is called to set the indirect reference. Thus, you wouldn't normally call this class's Save or Load methods from the owner if it derives from IRefTargMonitor.

See also:
IRefTargMonitor, IIndirectReferenceMaker

#include <IRefTargMonitor.h>

Inheritance diagram for RefTargMonitorRefMaker:
Inheritance graph
[legend]

List of all members.

Public Member Functions

CoreExport Class_ID  ClassID ()
  Retrieves a constant that uniquely identifies the plugin class.
CoreExport  RefTargMonitorRefMaker (IRefTargMonitor &myOwner, RefTargetHandle theTarget=NULL)
  Constructor for class instances.
CoreExport void  SetRef (RefTargetHandle theTarget)
  Set the object being watched.
CoreExport RefTargetHandle  GetRef ()
  Get the object being watched.
IOResult  Save (ISave *isave)
  Save a pointer to the object being watched.
IOResult  Load (ILoad *iload)
  Load a pointer to the object being watched.
int  Proc (RemapDir &remap)
  The PostPatchProc used when cloning.
RefResult  NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)
  This method will notify the RefTargMonitorRefMaker of changes to the watched object.
int  NumRefs ()
  Get the number of references instance makes.
RefTargetHandle  GetReference (int i)
  Get the indexed reference.
BOOL  IsRealDependency (ReferenceTarget *rtarg)
  Specifies that this reference to the watched object should not prevent the watched object from being deleted.
int  DoEnumDependentsImpl (DependentEnumProc *dep)
  Allows a reference target to enumerate all references to it.
void  DeleteThis ()
  Delete this instance.

Protected Member Functions

virtual void  SetReference (int i, RefTargetHandle rtarg)
  Set the indexed reference.

Constructor & Destructor Documentation

CoreExport RefTargMonitorRefMaker ( IRefTargMonitor myOwner,
RefTargetHandle  theTarget = NULL 
)

Constructor for class instances.

Parameters:
myOwner - The owner of the instance. The owner is responsible for deleting this instance. The owner must implement the IRefTargMonitor interface.
theTarget - The object instance to be watched.

Member Function Documentation

CoreExport Class_ID ClassID ( ) [virtual]

Retrieves a constant that uniquely identifies the plugin class.

This method must return the unique ID for the plugin class. If two ClassIDs conflict, the system will only load the first conflicting one it finds. A program (gencid.exe) is provided to generate unique class id values.

Returns:
A class id that uniquely identifies a plugin class
See also:
Class ClassID, List of Class IDs.

Reimplemented from Animatable.

CoreExport void SetRef ( RefTargetHandle  theTarget )

Set the object being watched.

Parameters:
theTarget - The object instance to be watched.
CoreExport RefTargetHandle GetRef ( )

Get the object being watched.

Returns:
The object instance being watched.
IOResult Save ( ISave isave ) [virtual]

Save a pointer to the object being watched.

The owner can call this method from its Save method it it wants to persistently watch the object across of load/save. As noted above, if the owner derives from IIndirectReferenceMaker, the owner typically would not call this method.

Parameters:
isave - The ISave pointer passed to the owner's Save method.
Returns:
One of the following values: IO_OK - The result was acceptable - no errors. IO_ERROR - This is returned if an error occurred.

Reimplemented from ReferenceMaker.

IOResult Load ( ILoad iload ) [virtual]

Load a pointer to the object being watched.

The owner can call this method from its Load method it it wants to persistently watch the object across of load/save. The owner would create a new RefTargMonitorRefMaker setting itself as an owner, and then call this method using that instance. As noted above, if the owner derives from IIndirectReferenceMaker, the owner typically would not call this method.

Parameters:
iload - The ILoad pointer passed to the owner's Load method.
Returns:
One of the following values: IO_OK - The result was acceptable - no errors. IO_ERROR - This is returned if an error occurred.

Reimplemented from ReferenceMaker.

int Proc ( RemapDir remap ) [virtual]

The PostPatchProc used when cloning.

The PostPatchProc is used when cloning since the watched object may or may not have also been cloned. When the owner is cloned, it would typically create a new RefTargMonitorRefMaker pointing at the cloned watched object. At the time the owner is cloned, the watched object may not have been cloned yet, or it may not be cloned at all. The owner should check to see if the watched object has been cloned already, and set the new RefTargMonitorRefMaker to watch it if so. If not, the new RefTargMonitorRefMaker should be set to watch the original watch object, and register this proc via remap.AddPostPatchProc. This proc will check after the cloning is complete whether the watch object was cloned, and if so set the clone as the watched object. If it was not cloned, the original object will be watched by the new RefTargMonitorRefMaker.

Parameters:
remap - The RemapDir passed to the owner's Clone method.
Returns:
TRUE in all cases

Implements PostPatchProc.

RefResult NotifyRefChanged ( Interval  changeInt,
RefTargetHandle  hTarget,
PartID partID,
RefMessage  message 
) [virtual]

This method will notify the RefTargMonitorRefMaker of changes to the watched object.

Implemented by the system. Changes to the watched object cause messages to be passed to this method, and the implementation of this method passes those messages to the owner via the owner's ProcessRefTargMonitorMsg callback

Returns:
The value returned from the owner's ProcessRefTargMonitorMsg callback

Implements ReferenceMaker.

int NumRefs ( ) [virtual]

Get the number of references instance makes.

Implemented by the system. RefTargMonitorRefMaker makes 1 reference - the watched object.

Returns:
The number of references instance makes.

Reimplemented from ReferenceMaker.

RefTargetHandle GetReference ( int  i ) [virtual]

Get the indexed reference.

Implemented by the system. The watched object should be accessed via GetRef and SetRef. This method is used by the system.

Returns:
The watched object.

Reimplemented from ReferenceMaker.

virtual void SetReference ( int  i,
RefTargetHandle  rtarg 
) [protected, virtual]

Set the indexed reference.

Implemented by the system. Sets the watched object. The watched object should be accessed via GetRef and SetRef. This method is used by the system.

Reimplemented from ReferenceMaker.

BOOL IsRealDependency ( ReferenceTarget rtarg ) [virtual]

Specifies that this reference to the watched object should not prevent the watched object from being deleted.

Implemented by the system.

Returns:
FALSE in all cases

Reimplemented from ReferenceMaker.

int DoEnumDependentsImpl ( DependentEnumProc dep ) [virtual]

Allows a reference target to enumerate all references to it.

Implemented by the system. This method allows a reference target to enumerate all references to it. The implementation of this method passes the DependentEnumProc to the owner via the owner's ProcessEnumDependents callback.

Returns:
1 to stop the enumeration and 0 to continue

Reimplemented from ReferenceMaker.

void DeleteThis ( ) [virtual]

Delete this instance.

Reimplemented from Animatable.


RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker
RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker RefTargMonitorRefMaker