interface_declare.h File Reference
Description
Mixin class template for deriving new interface declarations.
Code Example
interface_declare.h
//*****************************************************************************
// Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
//*****************************************************************************
//*****************************************************************************
#ifndef MI_BASE_INTERFACE_DECLARE_H
#define MI_BASE_INTERFACE_DECLARE_H
#include <mi/base/iinterface.h>
#include <mi/base/types.h>
#include <mi/base/uuid.h>
namespace mi {
namespace base {
// Forward declaration
class IInterface;
template <Uint32 id1, Uint16 id2, Uint16 id3
, Uint8 id4, Uint8 id5, Uint8 id6, Uint8 id7
, Uint8 id8, Uint8 id9, Uint8 id10, Uint8 id11
, class I = IInterface>
class Interface_declare : public I
{
public:
typedef Interface_declare< id1, id2, id3, id4, id5, id6, id7, id8, id9, id10, id11, I>
Self;
typedef Uuid_t< id1, id2, id3, id4, id5, id6, id7, id8, id9, id10, id11>
IID;
static bool compare_iid( const Uuid& iid) {
if( iid == IID())
return true;
return I::compare_iid( iid);
}
protected:
// Acquires a const interface.
//
// Static helper function for implementing #get_interface(const Uuid&).
//
// \param iinterface The interface to act on.
// \param interface_id Interface ID of the interface to acquire.
static const IInterface* get_interface_static(
const IInterface* iinterface,
const Uuid& interface_id)
{
if( interface_id == IID()) {
const Self* self = static_cast<const Self *>( iinterface);
self->retain();
return self;
}
return I::get_interface_static( iinterface, interface_id);
}
// Acquires a mutable interface.
//
// Static helper function for implementing #get_interface(const Uuid&).
//
// \param iinterface The interface to act on.
// \param interface_id Interface ID of the interface to acquire.
static IInterface* get_interface_static(
IInterface* iinterface,
const Uuid& interface_id)
{
if( interface_id == IID()) {
Self* self = static_cast<Self*>( iinterface);
self->retain();
return self;
}
return I::get_interface_static( iinterface, interface_id);
}
};
// end group mi_base_iinterface
} // namespace base
} // namespace mi
#endif // MI_BASE_INTERFACE_DECLARE_H
Namespaces
- namespace
- Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
- namespace
- Namespace for the Base API. More...
Classes
- class
- Mixin class template for deriving new interface declarations. More...