NVIDIA Iray API Home  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 1986, 2016 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
6 //*****************************************************************************
7 
8 #ifndef MI_NEURAYLIB_IATTRIBUTE_SET_H
9 #define MI_NEURAYLIB_IATTRIBUTE_SET_H
10 
13 #include <mi/neuraylib/version.h>
14 
15 namespace mi {
16 
17 class IData;
18 
19 namespace neuraylib {
20 
25 enum Propagation_type {
61  PROPAGATION_FORCE_32_BIT = 0xffffffffU
62 };
63 
64 mi_static_assert( sizeof( Propagation_type) == sizeof( Uint32));
65 
299  public base::Interface_declare<0x1bcb8d48,0x10c1,0x4b3e,0x9b,0xfa,0x06,0x23,0x61,0x81,0xd3,0xe1>
300 {
301 public:
314  virtual IData* create_attribute( const char* name, const char* type) = 0;
315 
348  template<class T>
349  T* create_attribute( const char* name, const char* type)
350  {
351  IData* ptr_iinterface = create_attribute( name, type);
352  if ( !ptr_iinterface)
353  return 0;
354  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
355  ptr_iinterface->release();
356  return ptr_T;
357  }
358 
388  template<class T>
389  T* create_attribute( const char* name)
390  {
391  return create_attribute<T>( name, Type_traits<T>::get_type_name());
392  }
393 
399  virtual bool destroy_attribute( const char* name) = 0;
400 
410  virtual const IData* access_attribute( const char* name) const = 0;
411 
428  template<class T>
429  const T* access_attribute( const char* name) const
430  {
431  const IData* ptr_iinterface = access_attribute( name);
432  if ( !ptr_iinterface)
433  return 0;
434  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
435  ptr_iinterface->release();
436  return ptr_T;
437  }
438 
448  virtual IData* edit_attribute( const char* name) = 0;
449 
466  template<class T>
467  T* edit_attribute( const char* name)
468  {
469  IData* ptr_iinterface = edit_attribute( name);
470  if ( !ptr_iinterface)
471  return 0;
472  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
473  ptr_iinterface->release();
474  return ptr_T;
475  }
476 
487  virtual bool is_attribute( const char* name) const = 0;
488 
503  virtual const char* get_attribute_type_name( const char* name) const = 0;
504 
511  virtual Sint32 set_attribute_propagation( const char* name, Propagation_type value) = 0;
512 
518  virtual Propagation_type get_attribute_propagation( const char* name) const = 0;
519 
525  virtual const char* enumerate_attributes( Sint32 index) const = 0;
526 };
527  // end group mi_neuray_scene_element
529 
530 } // namespace neuraylib
531 
532 #ifdef MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
533 using neuraylib::IAttribute_set;
534 using neuraylib::PROPAGATION_FORCE_32_BIT;
538 #endif // MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
539 
540 } // namespace mi
541 
542 #endif // MI_NEURAYLIB_IATTRIBUTE_SET_H