This mixin merges the implementation of one interface with a second interface. More...
#include <interface_merger.h>
Inherits MAJOR, and MINOR.
Public Types | |
typedef MAJOR | MAJOR_BASE |
Typedef for the MAJOR base class. More... | |
typedef MINOR | MINOR_BASE |
Typedef for the MINOR base class. More... | |
typedef Interface_merger<MAJOR, MINOR> | Self |
Typedef for this type. More... | |
Public Member Functions | |
const IInterface * | get_interface (const Uuid &interface_id) const |
Reimplements mi::base::IInterface::get_interface(const Uuid&) const. More... | |
template<class T> | |
const T * | get_interface () const |
Reimplements mi::base::IInterface::get_interface() const. More... | |
IInterface * | get_interface (const Uuid &interface_id) |
Reimplements mi::base::IInterface::get_interface(const Uuid&). More... | |
template<class T> | |
T * | get_interface () |
Reimplements mi::base::IInterface::get_interface(). More... | |
Uuid | get_iid () const |
Reimplements mi::base::IInterface::get_iid(). More... | |
mi::Uint32 | retain () const |
Reimplements mi::base::IInterface::retain(). More... | |
mi::Uint32 | release () const |
Reimplements mi::base::IInterface::release(). More... | |
const MAJOR * | cast_to_major () const |
Returns a pointer to the MAJOR base class. More... | |
MAJOR * | cast_to_major () |
Returns a pointer to the MAJOR base class. More... | |
Static Public Member Functions | |
static bool | compare_iid (const Uuid &iid) |
Reimplements mi::base::IInterface::compare_iid(). More... | |
This mixin merges the implementation of one interface with a second interface.
Multiple inheritance from interfaces is not possible due to ambiguities. This mixin resolves the ambiguities by re-implementing the methods of mi::base::IInterface.
Note that this mixin class derives from an implementation and an interface, in contrast to mi::base::Interface_implement_2, which derives from two interfaces. Basically, Interface_merger<Interface_implement<I1>
,I2> is equivalent to Interface_implement_2<I1,I2>
. The benefit of this mixin class is that you are not bound to use Interface_implement
, any valid implementation of an interface will do.
The template parameters representing the base classes are called MAJOR and MINOR. Note that the derivation is not symmetric:
retain()
and release()
are redirected to the MAJOR base classcompared_iid()
and get_interface()
are redirected to the MAJOR base class first, the MINOR base class is only queried on failure. For example, get_interface<mi::base::IInterface>()
will always return the MAJOR base class.get_iid()
is redirected to the MAJOR base class.Note that some versions of Microsoft Visual C++ are known to produce the bogus warning
in conjunction with this class. This warning can be disabled with
Note that the pragma affects the entire translation unit. Therefore, the warning is not disabled by default.
MAJOR | the implementation base class |
MINOR | the interface base class |