The CTempOLERef template class wraps any OLE object. When used to maintain references on OLE objects returned by SQL-DMO, the class ensures that references are released when:
CTempOLERef( );
CTempOLERef(OLEPTR pIn);
Creates an instance of the class.
OLEPTR p( );
Returns an OLEPTR (pointer to an OLE object) from the instance without incrementing the reference count maintained on the OLE object. Returns NULL if the instance is not maintaining a reference.
void Release( );
Safely releases a reference maintained by the instance on an OLE object. The function is provided for class completeness. Class destruction and assignment operator implementations ensure reference release and the use of Release is not required by an application.
operator OLEPTR ( );
Returns the reference maintained by the instance as an OLEPTR. Returns NULL if the instance is not maintaining a reference.
operator LPUNKNOWN ( );
Returns the reference maintained by the instance as an LPUNKNOWN. Returns NULL if the instance is not maintaining a reference.
operator void* ( );
Returns a void pointer to the memory maintaining an OLE object reference.
operator BOOL ( );
Returns TRUE when an instance maintains a reference on a BSTR object. Returns FALSE otherwise.
OLEPTR operator = (OLEPTR pIn);
If an OLE object reference is maintained by the instance, the reference is released. The instance maintains the reference on the OLE object assigned to the instance. Returns the reference assigned.
OLEPTR* operator & ();
Returns a pointer to the memory maintaining an OLE object reference as a pointer to an OLEPTR.
BOOL operator ! ();
Returns FALSE when an instance maintains a reference on a BSTR object. Returns TRUE otherwise.
OLEPTR operator -> ();
Returns the reference maintained by the instance as an OLEPTR. Returns NULL if the instance is not maintaining a reference.
Implements member function derefencing for the OLE object reference wrapped.