AcAxOleLinkManager

AcAxOleLinkManager is used to manage the link from the database-resident object to its COM object. This is done by attaching a transient reactor to the AcDbObject. The transient reactor has one variable containing a pointer to the IUnknown of the COM object. This transient reactor is also used to call IAcadBaseObject::OnModified() when the AcDbObject is modified.

AutoCAD maintains a single instance of AcAxOleLinkManager in each session. To get a pointer to the OLE link manager, use the AcAxGetOleLinkManager() function. The AcAxOleLinkManager class, which is declared in the oleaprot.h file, is described below:

// AcAxOleLinkManager is used to maintain the link between ARX
// objects and their respective COM wrapper.
//
class AcAxOleLinkManager
{
public:
    // Given a pointer to a database-resident object, return
    // the IUnknown of the COM wrapper. NULL is returned if
    // no wrapper is found.
    //
    virtual IUnknown* GetIUnknown(AcDbObject* pObject) = 0;
    // Set the link between a database-resident object and a 
    // COM wrapper. If the IUnknown is NULL, then the link 
    // is removed.
    //
    virtual Adesk::Boolean SetIUnknown(AcDbObject* pObject,
        IUnknown* pUnknown) = 0;
    // Given a pointer to a database object, return
    // the IUnknown of the COM wrapper. NULL is returned if
    // no wrapper is found.
    //
    virtual IUnknown* GetIUnknown(AcDbDatabase* pDatabase) = 0;
    // Set the link between a database object and a COM wrapper. 
    // If the IUnknown is NULL, then the link is removed.
    //
    virtual Adesk::Boolean SetIUnknown(AcDbDatabase* pDatabase,
        IUnknown* pUnknown) = 0;
    // Given a pointer to a database object, return the
    // IDispatch of the document object. NULL is returned if
    // the database does not belong to a particular document.
    //
    virtual IDispatch* GetDocIDispatch(AcDbDatabase* pDatabase)= 0;
    // Set the link between a database object and the IDispatch
    // of the document it belongs to. If the IDispatch is NULL, then 
    // the link is removed.
    //
    virtual Adesk::Boolean SetDocIDispatch(AcDbDatabase* pDatabase,
        IDispatch* pDispatch) = 0;
};