MDL SDK API nvidia_logo_transpbg.gif Up
iattribute_set.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2025 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_IATTRIBUTE_SET_H
8#define MI_NEURAYLIB_IATTRIBUTE_SET_H
9
11#include <mi/neuraylib/idata.h>
13
14namespace mi {
15namespace neuraylib {
16
57 PROPAGATION_FORCE_32_BIT = 0xffffffffU
58};
59
60mi_static_assert( sizeof( Propagation_type) == sizeof( Uint32));
61
374 public base::Interface_declare<0x1bcb8d48,0x10c1,0x4b3e,0x9b,0xfa,0x06,0x23,0x61,0x81,0xd3,0xe1>
375{
376public:
389 virtual IData* create_attribute( const char* name, const char* type) = 0;
390
423 template<class T>
424 T* create_attribute( const char* name, const char* type)
425 {
426 IData* ptr_iinterface = create_attribute( name, type);
427 if ( !ptr_iinterface)
428 return 0;
429 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
430 ptr_iinterface->release();
431 return ptr_T;
432 }
433
463 template<class T>
464 T* create_attribute( const char* name)
465 {
466 return create_attribute<T>( name, Type_traits<T>::get_type_name());
467 }
468
474 virtual bool destroy_attribute( const char* name) = 0;
475
485 virtual const IData* access_attribute( const char* name) const = 0;
486
503 template<class T>
504 const T* access_attribute( const char* name) const
505 {
506 const IData* ptr_iinterface = access_attribute( name);
507 if ( !ptr_iinterface)
508 return 0;
509 const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
510 ptr_iinterface->release();
511 return ptr_T;
512 }
513
523 virtual IData* edit_attribute( const char* name) = 0;
524
541 template<class T>
542 T* edit_attribute( const char* name)
543 {
544 IData* ptr_iinterface = edit_attribute( name);
545 if ( !ptr_iinterface)
546 return 0;
547 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
548 ptr_iinterface->release();
549 return ptr_T;
550 }
551
562 virtual bool is_attribute( const char* name) const = 0;
563
578 virtual const char* get_attribute_type_name( const char* name) const = 0;
579
586 virtual Sint32 set_attribute_propagation( const char* name, Propagation_type value) = 0;
587
591 virtual Propagation_type get_attribute_propagation( const char* name) const = 0;
592
598 virtual const char* enumerate_attributes( Sint32 index) const = 0;
599};
600 // end group mi_neuray_scene_element
602
603} // namespace neuraylib
604
605} // namespace mi
606
607#endif // MI_NEURAYLIB_IATTRIBUTE_SET_H
This interface is the base interface of all types.
Definition: idata.h:297
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
The attribute set comprises all attributes attached to a database element.
Definition: iattribute_set.h:375
T * edit_attribute(const char *name)
Returns a mutable pointer to the attribute name.
Definition: iattribute_set.h:542
virtual IData * edit_attribute(const char *name)=0
Returns a mutable pointer to the attribute name.
virtual const char * enumerate_attributes(Sint32 index) const =0
Returns the name of the attribute indicated by index.
const T * access_attribute(const char *name) const
Returns a const pointer to the attribute name.
Definition: iattribute_set.h:504
virtual Sint32 set_attribute_propagation(const char *name, Propagation_type value)=0
Sets the propagation type of the attribute name.
virtual IData * create_attribute(const char *name, const char *type)=0
Creates a new attribute name of the type type.
virtual const IData * access_attribute(const char *name) const =0
Returns a const pointer to the attribute name.
virtual bool is_attribute(const char *name) const =0
Indicates existence of an attribute.
virtual const char * get_attribute_type_name(const char *name) const =0
Returns the type of an attribute.
virtual Propagation_type get_attribute_propagation(const char *name) const =0
Returns the propagation type of the attribute name.
T * create_attribute(const char *name)
Creates a new attribute name of the type T.
Definition: iattribute_set.h:464
virtual bool destroy_attribute(const char *name)=0
Destroys the attribute name.
T * create_attribute(const char *name, const char *type)
Creates a new attribute name of the type type.
Definition: iattribute_set.h:424
#define mi_static_assert(expr)
Compile time assertion that raises a compilation error if the constant expression expr evaluates to f...
Definition: assert.h:58
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
virtual Uint32 release() const =0
Decrements the reference count.
int Sint32
32-bit signed integer.
Definition: types.h:46
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Propagation_type
Propagation types for attribute inheritance.
Definition: iattribute_set.h:54
@ PROPAGATION_STANDARD
Standard inheritance of attributes without any special flags.
Definition: iattribute_set.h:55
@ PROPAGATION_OVERRIDE
The override flag for attribute inheritance.
Definition: iattribute_set.h:56
Types.
Mixin class template for deriving new interface declarations.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5
Type traits relating interfaces, corresponding primitive types, and their type names.
Definition: type_traits.h:162
Type traits.