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
ifactory.h
Go to the documentation of this file.
1
/***************************************************************************************************
2
* Copyright 2022 NVIDIA Corporation. All rights reserved.
3
**************************************************************************************************/
6
7
#ifndef MI_NEURAYLIB_IFACTORY_H
8
#define MI_NEURAYLIB_IFACTORY_H
9
10
#include <
mi/base/interface_declare.h
>
11
#include <
mi/neuraylib/idata.h
>
12
#include <
mi/neuraylib/type_traits.h
>
13
14
namespace
mi {
15
16
class
IEnum_decl;
17
class
IString;
18
class
IStructure_decl;
19
20
namespace
neuraylib {
21
22
class
ITransaction;
23
28
class
IFactory :
public
34
mi::base::Interface_declare
<0x8afad838,0xe597,0x4a81,0x92,0x34,0x51,0xfe,0xa4,0xff,0x04,0x31>
35
{
36
public
:
60
virtual
base::IInterface*
create
(
61
const
char
* type_name,
62
Uint32
argc = 0,
63
const
base::IInterface* argv[] = 0) = 0;
64
104
template
<
class
T>
105
T*
create
(
106
const
char
* type_name,
107
Uint32
argc = 0,
108
const
base::IInterface
* argv[] = 0)
109
{
110
base::IInterface
* ptr_iinterface =
create
( type_name, argc, argv);
111
if
( !ptr_iinterface)
112
return
0;
113
T* ptr_T =
static_cast<
T*
>
( ptr_iinterface->
get_interface
(
typename
T::IID()));
114
ptr_iinterface->
release
();
115
return
ptr_T;
116
}
117
152
template
<
class
T>
153
T*
create
()
154
{
155
return
create<T>(
Type_traits<T>::get_type_name
());
156
}
157
162
enum
Assign_result
163
{
166
NULL_POINTER
= 1,
167
173
STRUCTURAL_MISMATCH
= 2,
174
178
NO_CONVERSION
= 4,
179
181
TARGET_KEY_MISSING
= 8,
182
184
SOURCE_KEY_MISSING
= 16,
185
190
DIFFERENT_COLLECTIONS
= 32,
191
196
NON_IDATA_VALUES
= 64,
197
202
INCOMPATIBLE_POINTER_TYPES
= 128,
203
206
DEEP_ASSIGNMENT_TO_CONST_POINTER
= 256,
207
210
INCOMPATIBLE_PRIVACY_LEVELS
= 1024,
211
213
INCOMPATIBLE_ENUM_TYPES
= 2048,
214
216
INCOMPATIBLE_OPTIONS
= 4096,
217
218
// Undocumented, for alignment only
219
FORCE_32_BIT_RESULT = 0xffffffffU
220
};
221
226
enum
Assign_clone_options
227
{
233
DEEP_ASSIGNMENT_OR_CLONE
= 1,
234
237
FIX_SET_OF_TARGET_KEYS
= 4,
238
239
// Undocumented, for alignment only
240
FORCE_32_BIT_OPTIONS = 0xffffffffU
241
};
242
264
virtual
Uint32
assign_from_to
(
const
IData
* source,
IData
* target,
Uint32
options = 0) = 0;
265
273
virtual
IData
*
clone
(
const
IData
* source,
Uint32
options = 0) = 0;
274
289
template
<
class
T>
290
T*
clone
(
const
IData
* source,
Uint32
options = 0)
291
{
292
mi::base::IInterface
* ptr_iinterface =
clone
( source, options);
293
if
( !ptr_iinterface)
294
return
0;
295
T* ptr_T =
static_cast<
T*
>
( ptr_iinterface->
get_interface
(
typename
T::IID()));
296
ptr_iinterface->
release
();
297
return
ptr_T;
298
}
299
332
virtual
Sint32
compare
(
const
IData
* lhs,
const
IData
* rhs) = 0;
333
345
virtual
const
IString
*
dump
(
const
IData
* data,
const
char
* name = 0,
Size
depth = 0) = 0;
346
352
virtual
const
IString
*
dump
(
353
neuraylib::ITransaction
* transaction,
354
const
IData
* data,
355
const
char
* name = 0,
356
Size
depth = 0) = 0;
357
363
virtual
const
IStructure_decl
*
get_structure_decl
(
const
char
* structure_name)
const
= 0;
364
370
virtual
const
IEnum_decl
*
get_enum_decl
(
const
char
* enum_name)
const
= 0;
371
};
372
373
mi_static_assert
(
sizeof
(
IFactory::Assign_result
) ==
sizeof
(
Uint32
));
374
mi_static_assert
(
sizeof
(
IFactory::Assign_clone_options
) ==
sizeof
(
Uint32
));
375
// end group mi_neuray_types
377
378
}
// namespace neuraylib
379
380
}
// namespace mi
381
382
#endif // MI_NEURAYLIB_IFACTORY_H
5 April 2022, 20:40, rev.358266
© 2022 NVIDIA Corporation.
All rights reserved.