Material Definition Language API nvidia_logo_transpbg.gif Up
 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 2020 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 
14 namespace mi {
15 namespace neuraylib {
16 
21 enum Propagation_type {
57  PROPAGATION_FORCE_32_BIT = 0xffffffffU
58 };
59 
60 mi_static_assert( sizeof( Propagation_type) == sizeof( Uint32));
61 
322  public base::Interface_declare<0x1bcb8d48,0x10c1,0x4b3e,0x9b,0xfa,0x06,0x23,0x61,0x81,0xd3,0xe1>
323 {
324 public:
337  virtual IData* create_attribute( const char* name, const char* type) = 0;
338 
371  template<class T>
372  T* create_attribute( const char* name, const char* type)
373  {
374  IData* ptr_iinterface = create_attribute( name, type);
375  if ( !ptr_iinterface)
376  return 0;
377  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
378  ptr_iinterface->release();
379  return ptr_T;
380  }
381 
411  template<class T>
412  T* create_attribute( const char* name)
413  {
414  return create_attribute<T>( name, Type_traits<T>::get_type_name());
415  }
416 
422  virtual bool destroy_attribute( const char* name) = 0;
423 
433  virtual const IData* access_attribute( const char* name) const = 0;
434 
451  template<class T>
452  const T* access_attribute( const char* name) const
453  {
454  const IData* ptr_iinterface = access_attribute( name);
455  if ( !ptr_iinterface)
456  return 0;
457  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
458  ptr_iinterface->release();
459  return ptr_T;
460  }
461 
471  virtual IData* edit_attribute( const char* name) = 0;
472 
489  template<class T>
490  T* edit_attribute( const char* name)
491  {
492  IData* ptr_iinterface = edit_attribute( name);
493  if ( !ptr_iinterface)
494  return 0;
495  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
496  ptr_iinterface->release();
497  return ptr_T;
498  }
499 
510  virtual bool is_attribute( const char* name) const = 0;
511 
526  virtual const char* get_attribute_type_name( const char* name) const = 0;
527 
534  virtual Sint32 set_attribute_propagation( const char* name, Propagation_type value) = 0;
535 
539  virtual Propagation_type get_attribute_propagation( const char* name) const = 0;
540 
546  virtual const char* enumerate_attributes( Sint32 index) const = 0;
547 };
548  // end group mi_neuray_scene_element
550 
551 } // namespace neuraylib
552 
553 } // namespace mi
554 
555 #endif // MI_NEURAYLIB_IATTRIBUTE_SET_H