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
331 public base::Interface_declare<0x1bcb8d48,0x10c1,0x4b3e,0x9b,0xfa,0x06,0x23,0x61,0x81,0xd3,0xe1>
332{
333public:
346 virtual IData* create_attribute( const char* name, const char* type) = 0;
347
380 template<class T>
381 T* create_attribute( const char* name, const char* type)
382 {
383 IData* ptr_iinterface = create_attribute( name, type);
384 if ( !ptr_iinterface)
385 return 0;
386 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
387 ptr_iinterface->release();
388 return ptr_T;
389 }
390
420 template<class T>
421 T* create_attribute( const char* name)
422 {
423 return create_attribute<T>( name, Type_traits<T>::get_type_name());
424 }
425
431 virtual bool destroy_attribute( const char* name) = 0;
432
442 virtual const IData* access_attribute( const char* name) const = 0;
443
460 template<class T>
461 const T* access_attribute( const char* name) const
462 {
463 const IData* ptr_iinterface = access_attribute( name);
464 if ( !ptr_iinterface)
465 return 0;
466 const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
467 ptr_iinterface->release();
468 return ptr_T;
469 }
470
480 virtual IData* edit_attribute( const char* name) = 0;
481
498 template<class T>
499 T* edit_attribute( const char* name)
500 {
501 IData* ptr_iinterface = edit_attribute( name);
502 if ( !ptr_iinterface)
503 return 0;
504 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
505 ptr_iinterface->release();
506 return ptr_T;
507 }
508
519 virtual bool is_attribute( const char* name) const = 0;
520
535 virtual const char* get_attribute_type_name( const char* name) const = 0;
536
543 virtual Sint32 set_attribute_propagation( const char* name, Propagation_type value) = 0;
544
548 virtual Propagation_type get_attribute_propagation( const char* name) const = 0;
549
555 virtual const char* enumerate_attributes( Sint32 index) const = 0;
556};
557 // end group mi_neuray_scene_element
559
560} // namespace neuraylib
561
562} // namespace mi
563
564#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:332
T * edit_attribute(const char *name)
Returns a mutable pointer to the attribute name.
Definition: iattribute_set.h:499
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:461
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:421
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:381
#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.