Material Definition Language 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
iattribute_set.h
Go to the documentation of this file.
1
/***************************************************************************************************
2
* Copyright 2019 NVIDIA Corporation. All rights reserved.
3
**************************************************************************************************/
6
7
#ifndef MI_NEURAYLIB_IATTRIBUTE_SET_H
8
#define MI_NEURAYLIB_IATTRIBUTE_SET_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
namespace
neuraylib {
16
21
enum
Propagation_type
{
55
PROPAGATION_STANDARD
,
56
PROPAGATION_OVERRIDE
,
57
PROPAGATION_FORCE_32_BIT = 0xffffffffU
58
};
59
60
mi_static_assert
(
sizeof
(
Propagation_type
) ==
sizeof
(
Uint32
));
61
319
class
IAttribute_set
:
320
public
base::Interface_declare
<0x1bcb8d48,0x10c1,0x4b3e,0x9b,0xfa,0x06,0x23,0x61,0x81,0xd3,0xe1>
321
{
322
public
:
335
virtual
IData
*
create_attribute
(
const
char
* name,
const
char
* type) = 0;
336
369
template
<
class
T>
370
T*
create_attribute
(
const
char
* name,
const
char
* type)
371
{
372
IData
* ptr_iinterface =
create_attribute
( name, type);
373
if
( !ptr_iinterface)
374
return
0;
375
T* ptr_T =
static_cast<
T*
>
( ptr_iinterface->
get_interface
(
typename
T::IID()));
376
ptr_iinterface->
release
();
377
return
ptr_T;
378
}
379
409
template
<
class
T>
410
T*
create_attribute
(
const
char
* name)
411
{
412
return
create_attribute<T>( name,
Type_traits<T>::get_type_name
());
413
}
414
420
virtual
bool
destroy_attribute
(
const
char
* name) = 0;
421
431
virtual
const
IData
*
access_attribute
(
const
char
* name)
const
= 0;
432
449
template
<
class
T>
450
const
T*
access_attribute
(
const
char
* name)
const
451
{
452
const
IData
* ptr_iinterface =
access_attribute
( name);
453
if
( !ptr_iinterface)
454
return
0;
455
const
T* ptr_T =
static_cast<
const
T*
>
( ptr_iinterface->
get_interface
(
typename
T::IID()));
456
ptr_iinterface->
release
();
457
return
ptr_T;
458
}
459
469
virtual
IData
*
edit_attribute
(
const
char
* name) = 0;
470
487
template
<
class
T>
488
T*
edit_attribute
(
const
char
* name)
489
{
490
IData
* ptr_iinterface =
edit_attribute
( name);
491
if
( !ptr_iinterface)
492
return
0;
493
T* ptr_T =
static_cast<
T*
>
( ptr_iinterface->
get_interface
(
typename
T::IID()));
494
ptr_iinterface->
release
();
495
return
ptr_T;
496
}
497
508
virtual
bool
is_attribute
(
const
char
* name)
const
= 0;
509
524
virtual
const
char
*
get_attribute_type_name
(
const
char
* name)
const
= 0;
525
532
virtual
Sint32
set_attribute_propagation
(
const
char
* name,
Propagation_type
value) = 0;
533
537
virtual
Propagation_type
get_attribute_propagation
(
const
char
* name)
const
= 0;
538
544
virtual
const
char
*
enumerate_attributes
(
Sint32
index)
const
= 0;
545
};
546
// end group mi_neuray_scene_element
548
549
}
// namespace neuraylib
550
551
}
// namespace mi
552
553
#endif // MI_NEURAYLIB_IATTRIBUTE_SET_H
20 February 2019, 22:00, revision 315630, Doxygen 1.8.4
© 1986, 2019 NVIDIA Corporation.
All rights reserved.