ChainInterfaces Structure

Specifies verification and initialization functions that can be applied to a set of interface IDs.

Syntax

template <
    typename I0,
    typename I1,
    typename I2 = Details::Nil,
    typename I3 = Details::Nil,
    typename I4 = Details::Nil,
    typename I5 = Details::Nil,
    typename I6 = Details::Nil,
    typename I7 = Details::Nil,
    typename I8 = Details::Nil,
    typename I9 = Details::Nil
>
struct ChainInterfaces : I0;

template <
    typename DerivedType,
    typename BaseType,
    bool hasImplements,
    typename I1,
    typename I2,
    typename I3,
    typename I4,
    typename I5,
    typename I6,
    typename I7,
    typename I8,
    typename I9
>
struct ChainInterfaces<
    MixIn<
        DerivedType,
        BaseType,
        hasImplements
    >, I1, I2, I3, I4, I5, I6, I7, I8, I9
>;

Parameters

I0
(Required) Interface ID 0.

I1
(Required) Interface ID 1.

I2
(Optional) Interface ID 2.

I3
(Optional) Interface ID 3.

I4
(Optional) Interface ID 4.

I5
(Optional) Interface ID 5.

I6
(Optional) Interface ID 6.

I7
(Optional) Interface ID 7.

I8
(Optional) Interface ID 8.

I9
(Optional) Interface ID 9.

DerivedType
A derived type.

BaseType
The base type of a derived type.

hasImplements
A Boolean value that if true, means you can't use a MixIn structure with a class that does not derive from the Implements stucture.

Members

Protected Methods

Name Description
ChainInterfaces::CanCastTo Indicates whether the specified interface ID can be cast to each of the specializations defined by the ChainInterface template parameters.
ChainInterfaces::CastToUnknown Casts the interface pointer of the type defined by the I0 template parameter to a pointer to IUnknown.
ChainInterfaces::FillArrayWithIid Stores the interface ID defined by the I0 template parameter into a specified location in a specified array of interface IDs.
ChainInterfaces::Verify Verifies that each interface defined by template parameters I0 through I9 inherits from IUnknown and/or IInspectable, and that I0 inherits from I1 through I9.

Protected Constants

Name Description
ChainInterfaces::IidCount The total number of interface IDs contained in the interfaces specified by template parameters I0 through I9.

Inheritance Hierarchy

I0

ChainInterfaces

Requirements

Header: implements.h

Namespace: Microsoft::WRL

ChainInterfaces::CanCastTo

Indicates whether the specified interface ID can be cast to each of the specializations defined by the non-default template parameters.

__forceinline bool CanCastTo(
   REFIID riid,
   _Deref_out_ void **ppv
);

Parameters

riid
An interface ID.

ppv
A pointer to the last interface ID that was cast successfully.

Return Value

true if all the cast operations succeeded; otherwise, false.

ChainInterfaces::CastToUnknown

Casts the interface pointer of the type defined by the I0 template parameter to a pointer to IUnknown.

__forceinline IUnknown* CastToUnknown();

Return Value

A pointer to IUnknown.

ChainInterfaces::FillArrayWithIid

Stores the interface ID defined by the I0 template parameter into a specified location in a specified array of interface IDs.

__forceinline static void FillArrayWithIid(
   _Inout_ unsigned long &index,
   _In_ IID* iids
);

Parameters

index
Pointer to an index value into the iids array.

iids
An array of interface IDs.

ChainInterfaces::IidCount

The total number of interface IDs contained in the interfaces specified by template parameters I0 through I9.

static const unsigned long IidCount = Details::InterfaceTraits<I0>::IidCount + Details::InterfaceTraits<I1>::IidCount + Details::InterfaceTraits<I2>::IidCount + Details::InterfaceTraits<I3>::IidCount + Details::InterfaceTraits<I4>::IidCount + Details::InterfaceTraits<I5>::IidCount + Details::InterfaceTraits<I6>::IidCount + Details::InterfaceTraits<I7>::IidCount + Details::InterfaceTraits<I8>::IidCount + Details::InterfaceTraits<I9>::IidCount;

Return Value

The total number of interface IDs.

Remarks

Template parameters I0 and I1 are required, and parameters I2 through I9 are optional. The IID count of each interface is typically 1.

ChainInterfaces::Verify

Verifies that each interface defined by template parameters I0 through I9 inherits from IUnknown and/or IInspectable, and that I0 inherits from I1 through I9.

WRL_NOTHROW __forceinline static void Verify();

Remarks

If the verification operation fails, a static_assert emits an error message describing the failure.

Template parameters I0 and I1 are required, and parameters I2 through I9 are optional.