Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

template<class I1, class I2>
bool ComPtrEquals ( I1 *  aThis,
I2 *  aThat 
) [inline]

Returns true if two interface pointers are equal.

According to the COM Identity Rule, interface pointers are considered to be equal if and only if IUnknown pointers queried on these interfaces pointers are equal (e.g. have the same binary value). Equal interface pointers represent the same object even if they are pointers to different interfaces.

I1 Class of the first interface pointer (must be derived from IUnknown).
I2 Class of the second interface pointer (must be derived from IUnknown).

Definition at line 99 of file ptr.h.

References NULL.

    IUnknown *thatUnk = NULL, *thisUnk = NULL;
    if (aThat)
        aThat->QueryInterface (COM_IIDOF (IUnknown), (void **) &thatUnk);
    if (aThis)
        aThis->QueryInterface (COM_IIDOF (IUnknown), (void **) &thisUnk);
    bool equal = thisUnk == thatUnk;
    if (thisUnk)
    if (thatUnk)
    return equal;

Generated by  Doxygen 1.6.0   Back to index