MDL SDK 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 2022 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 
333  public base::Interface_declare<0x1bcb8d48,0x10c1,0x4b3e,0x9b,0xfa,0x06,0x23,0x61,0x81,0xd3,0xe1>
334 {
335 public:
348  virtual IData* create_attribute( const char* name, const char* type) = 0;
349 
382  template<class T>
383  T* create_attribute( const char* name, const char* type)
384  {
385  IData* ptr_iinterface = create_attribute( name, type);
386  if ( !ptr_iinterface)
387  return 0;
388  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
389  ptr_iinterface->release();
390  return ptr_T;
391  }
392 
422  template<class T>
423  T* create_attribute( const char* name)
424  {
425  return create_attribute<T>( name, Type_traits<T>::get_type_name());
426  }
427 
433  virtual bool destroy_attribute( const char* name) = 0;
434 
444  virtual const IData* access_attribute( const char* name) const = 0;
445 
462  template<class T>
463  const T* access_attribute( const char* name) const
464  {
465  const IData* ptr_iinterface = access_attribute( name);
466  if ( !ptr_iinterface)
467  return 0;
468  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
469  ptr_iinterface->release();
470  return ptr_T;
471  }
472 
482  virtual IData* edit_attribute( const char* name) = 0;
483 
500  template<class T>
501  T* edit_attribute( const char* name)
502  {
503  IData* ptr_iinterface = edit_attribute( name);
504  if ( !ptr_iinterface)
505  return 0;
506  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
507  ptr_iinterface->release();
508  return ptr_T;
509  }
510 
521  virtual bool is_attribute( const char* name) const = 0;
522 
537  virtual const char* get_attribute_type_name( const char* name) const = 0;
538 
545  virtual Sint32 set_attribute_propagation( const char* name, Propagation_type value) = 0;
546 
550  virtual Propagation_type get_attribute_propagation( const char* name) const = 0;
551 
557  virtual const char* enumerate_attributes( Sint32 index) const = 0;
558 };
559  // end group mi_neuray_scene_element
561 
562 } // namespace neuraylib
563 
564 } // namespace mi
565 
566 #endif // MI_NEURAYLIB_IATTRIBUTE_SET_H