MDL SDK API
Up
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
interface_declare.h
Go to the documentation of this file.
1
/***************************************************************************************************
2
* Copyright 2022 NVIDIA Corporation. All rights reserved.
3
**************************************************************************************************/
6
7
#ifndef MI_BASE_INTERFACE_DECLARE_H
8
#define MI_BASE_INTERFACE_DECLARE_H
9
10
#include <
mi/base/iinterface.h
>
11
#include <
mi/base/types.h
>
12
#include <
mi/base/uuid.h
>
13
14
namespace
mi {
15
namespace
base {
16
21
// Forward declaration
22
class
IInterface;
23
38
template
<
Uint32
id1,
Uint16
id2,
Uint16
id3
39
,
Uint8
id4,
Uint8
id5,
Uint8
id6,
Uint8
id7
40
,
Uint8
id8,
Uint8
id9,
Uint8
id10,
Uint8
id11
41
,
class
I = IInterface>
42
class
Interface_declare
:
public
I
43
{
44
public
:
46
typedef
Interface_declare<id1,id2,id3,id4,id5,id6,id7,id8,id9,id10,id11,I>
Self
;
47
49
typedef
Uuid_t<id1,id2,id3,id4,id5,id6,id7,id8,id9,id10,id11>
IID
;
50
56
static
bool
compare_iid
(
const
Uuid
& iid) {
57
if
( iid ==
IID
())
58
return
true
;
59
return
I::compare_iid( iid);
60
}
61
62
protected
:
63
// Acquires a const interface.
64
//
65
// Static helper function for implementing #get_interface(const Uuid&).
66
//
67
// \param iinterface The interface to act on.
68
// \param interface_id Interface ID of the interface to acquire.
69
static
const
IInterface
* get_interface_static(
70
const
IInterface
* iinterface,
71
const
Uuid
& interface_id)
72
{
73
if
( interface_id ==
IID
()) {
74
const
Self
*
self
=
static_cast<
const
Self
*
>
( iinterface);
75
self
->retain();
76
return
self
;
77
}
78
return
I::get_interface_static( iinterface, interface_id);
79
}
80
81
// Acquires a mutable interface.
82
//
83
// Static helper function for implementing #get_interface(const Uuid&).
84
//
85
// \param iinterface The interface to act on.
86
// \param interface_id Interface ID of the interface to acquire.
87
static
IInterface* get_interface_static(
88
IInterface* iinterface,
89
const
Uuid& interface_id)
90
{
91
if
( interface_id ==
IID
()) {
92
Self
*
self
=
static_cast<
Self
*
>
( iinterface);
93
self
->retain();
94
return
self
;
95
}
96
return
I::get_interface_static( iinterface, interface_id);
97
}
98
};
99
// end group mi_base_iinterface
101
102
}
// namespace base
103
}
// namespace mi
104
105
#endif // MI_BASE_INTERFACE_DECLARE_H
5 April 2022, 20:40, rev.358266
© 2022 NVIDIA Corporation.
All rights reserved.