template< class contained >
class CComAggObject : public IUnknown,
public CComObjectRootEx<
contained::_ThreadModel::ThreadModelNoCS >
Parameters
contained Your class, derived from CComObjectRoot or CComObjectRootEx, as well as from any other interfaces you want to support on the object.
CComAggObject implements IUnknown for an aggregated object. CComAggObject has its own IUnknown, separate from the outer object's IUnknown, and maintains its own reference count.
CComAggObject uses CComContainedObject to delegate to the outer unknown.
For more information about aggregation, see the article Fundamentals of ATL COM Objects.
#include <atlcom.h>
See Also CComObject, CComPolyObject, DECLARE_AGGREGATABLE, DECLARE_ONLY_AGGREGATABLE, DECLARE_NOT_AGGREGATABLE
Class Methods | |
CComAggObject | Constructor. |
FinalConstruct | Performs final initialization of m_contained. |
FinalRelease | Performs final destruction of m_contained. |
IUnknown Methods | |
AddRef | Increments the reference count on the aggregated object. |
QueryInterface | Retrieves a pointer to the requested interface. |
Release | Decrements the reference count on the aggregated object. |
Data Members | |
m_contained | Delegates IUnknown calls to the outer unknown. |
ULONG AddRef( );
Return Value
A value that may be useful for diagnostics or testing.
Remarks
Increments the reference count on the aggregated object.
CComAggObject Overview | Class Members
See Also CComAggObject::Release
CComAggObject( void* pv );
Parameters
pv [in] The outer unknown.
Remarks
The constructor. Initializes the CComContainedObject member, m_contained, and increments the module lock count.
The destructor decrements the module lock count.
CComAggObject Overview | Class Members
See Also CComAggObject::FinalConstruct, CComAggObject::FinalRelease
HRESULT FinalConstruct( );
Return Value
A standard HRESULT value.
Remarks
Called during the final stages of object construction, this method performs any final initialization on the m_contained member.
CComAggObject Overview | Class Members
See Also CComObjectRootEx::FinalConstruct, CComAggObject::FinalRelease
void FinalRelease( );
Remarks
Called during object destruction, this method frees the m_contained member.
CComAggObject Overview | Class Members
See Also CComObjectRootEx::FinalRelease, CComAggObject::FinalConstruct
HRESULT QueryInterface( REFIID iid, void** ppvObject );
Return Value
A standard HRESULT value.
Parameters
iid [in] The identifier of the interface being requested.
ppvObject [out] A pointer to the interface pointer identified by iid. If the object does not support this interface, ppvObject is set to NULL.
Remarks
Retrieves a pointer to the requested interface. If the requested interface is IUnknown, QueryInterface returns a pointer to the aggregated object's own IUnknown and increments the reference count. Otherwise, this method queries for the interface through the CComContainedObject member, m_contained.
CComAggObject Overview | Class Members
ULONG Release( );
Return Value
In debug builds, Release returns a value that may be useful for diagnostics or testing. In non-debug builds, Release always returns 0.
Remarks
Decrements the reference count on the aggregated object.
CComAggObject Overview | Class Members
See Also CComAggObject::AddRef
CComContainedObject< contained > m_contained;
Parameters
contained [in] Your class, derived from CComObjectRoot as well as from any other interface you want to support on the object.
Remarks
A CComContainedObject object derived from your class. All IUnknown calls through m_contained are delegated to the outer unknown.