MDL SDK API nvidia_logo_transpbg.gif Up
iattribute_set.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 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
372 public base::Interface_declare<0x1bcb8d48,0x10c1,0x4b3e,0x9b,0xfa,0x06,0x23,0x61,0x81,0xd3,0xe1>
373{
374public:
387 virtual IData* create_attribute( const char* name, const char* type) = 0;
388
421 template<class T>
422 T* create_attribute( const char* name, const char* type)
423 {
424 IData* ptr_iinterface = create_attribute( name, type);
425 if ( !ptr_iinterface)
426 return 0;
427 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
428 ptr_iinterface->release();
429 return ptr_T;
430 }
431
461 template<class T>
462 T* create_attribute( const char* name)
463 {
464 return create_attribute<T>( name, Type_traits<T>::get_type_name());
465 }
466
472 virtual bool destroy_attribute( const char* name) = 0;
473
483 virtual const IData* access_attribute( const char* name) const = 0;
484
501 template<class T>
502 const T* access_attribute( const char* name) const
503 {
504 const IData* ptr_iinterface = access_attribute( name);
505 if ( !ptr_iinterface)
506 return 0;
507 const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
508 ptr_iinterface->release();
509 return ptr_T;
510 }
511
521 virtual IData* edit_attribute( const char* name) = 0;
522
539 template<class T>
540 T* edit_attribute( const char* name)
541 {
542 IData* ptr_iinterface = edit_attribute( name);
543 if ( !ptr_iinterface)
544 return 0;
545 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
546 ptr_iinterface->release();
547 return ptr_T;
548 }
549
560 virtual bool is_attribute( const char* name) const = 0;
561
576 virtual const char* get_attribute_type_name( const char* name) const = 0;
577
584 virtual Sint32 set_attribute_propagation( const char* name, Propagation_type value) = 0;
585
589 virtual Propagation_type get_attribute_propagation( const char* name) const = 0;
590
596 virtual const char* enumerate_attributes( Sint32 index) const = 0;
597};
598 // end group mi_neuray_scene_element
600
601} // namespace neuraylib
602
603} // namespace mi
604
605#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:373
T * edit_attribute(const char *name)
Returns a mutable pointer to the attribute name.
Definition: iattribute_set.h:540
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:502
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:462
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:422
#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.
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
signed int Sint32
32-bit signed integer.
Definition: types.h:46
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.