IRefTargMonitor.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2005 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 // DESCRIPTION: Defines a class for monitoring a ReferenceTarget by holding a weak reference to it
00012 // (IsRealDependency returns false) and passing NotifyRefChanged messages to the owner of the
00013 // class instance. 
00014 // AUTHOR: Larry.Minton - created May.14.2004
00015 //***************************************************************************/
00016 
00017 #pragma once
00018 #include "maxheap.h"
00019 #include "ref.h"
00020 
00022 #define IID_REFTARG_MONITOR 0x3070552c
00023 
00025 
00028 #define REFMSG_REFTARGMONITOR_TARGET_SET    REFMSG_USER + 0x3070552c  
00029 
00031 
00035 class IRefTargMonitor: public MaxHeapOperators {
00036 public:
00038 
00055     virtual RefResult ProcessRefTargMonitorMsg(
00056                         Interval changeInt, 
00057                         RefTargetHandle hTarget, 
00058                         PartID& partID,  
00059                         RefMessage message,
00060                         bool fromMonitoredTarget) = 0;
00061 
00063 
00069     virtual int ProcessEnumDependents(DependentEnumProc* dep) = 0;
00070 };
00071 
00073 
00083 class RefTargMonitorRefMaker: public ReferenceMaker, public PostPatchProc {
00084 private:
00085     IRefTargMonitor &mOwner;    // the owner of this instance
00086     RefTargetHandle mpTarget;   // the object being monitored
00087 
00089     ~RefTargMonitorRefMaker();
00090 
00091 public:
00092     CoreExport Class_ID ClassID();
00093 
00095 
00099     CoreExport RefTargMonitorRefMaker(IRefTargMonitor &myOwner, RefTargetHandle theTarget = NULL);
00100 
00102 
00104     CoreExport void SetRef(RefTargetHandle theTarget);
00105 
00107 
00109     CoreExport RefTargetHandle GetRef();
00110 
00112 
00120     IOResult Save(ISave *isave);
00121 
00123 
00132     IOResult Load(ILoad *iload);
00133 
00135 
00146     int Proc(RemapDir& remap);
00147 
00148     // ReferenceMaker Methods
00150 
00155     RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message );
00156 
00158 
00162     int NumRefs();
00163 
00165 
00169     RefTargetHandle GetReference(int i);
00170 
00172 
00176 protected:
00177     virtual void SetReference(int i, RefTargetHandle rtarg);
00178 public:
00179 
00181 
00184     BOOL IsRealDependency(ReferenceTarget *rtarg);
00185 
00187 
00192     int DoEnumDependentsImpl(DependentEnumProc* dep);
00193 
00195     void DeleteThis();
00196 };
00197