NVIDIA Iray API
 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, 2014 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
6 //*****************************************************************************
7 
8 #ifndef MI_NEURAYLIB_IATTRIBUTE_SET_H
9 #define MI_NEURAYLIB_IATTRIBUTE_SET_H
10 
13 
14 namespace mi {
15 
16 class IData;
17 
22 enum Propagation_type {
60  PROPAGATION_FORCE_32_BIT = 0xffffffffU
61 };
62 
63 mi_static_assert( sizeof( Propagation_type) == sizeof( Uint32));
64 
285  public base::Interface_declare<0x1bcb8d48,0x10c1,0x4b3e,0x9b,0xfa,0x06,0x23,0x61,0x81,0xd3,0xe1>
286 {
287 public:
300  virtual IData* create_attribute( const char* name, const char* type) = 0;
301 
334  template<class T>
335  T* create_attribute( const char* name, const char* type)
336  {
337  IData* ptr_iinterface = create_attribute( name, type);
338  if ( !ptr_iinterface)
339  return 0;
340  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
341  ptr_iinterface->release();
342  return ptr_T;
343  }
344 
374  template<class T>
375  T* create_attribute( const char* name)
376  {
377  return create_attribute<T>( name, Type_traits<T>::get_type_name());
378  }
379 
385  virtual bool destroy_attribute( const char* name) = 0;
386 
396  virtual const IData* access_attribute( const char* name) const = 0;
397 
414  template<class T>
415  const T* access_attribute( const char* name) const
416  {
417  const IData* ptr_iinterface = access_attribute( name);
418  if ( !ptr_iinterface)
419  return 0;
420  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
421  ptr_iinterface->release();
422  return ptr_T;
423  }
424 
434  virtual IData* edit_attribute( const char* name) = 0;
435 
452  template<class T>
453  T* edit_attribute( const char* name)
454  {
455  IData* ptr_iinterface = edit_attribute( name);
456  if ( !ptr_iinterface)
457  return 0;
458  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
459  ptr_iinterface->release();
460  return ptr_T;
461  }
462 
473  virtual bool is_attribute( const char* name) const = 0;
474 
486  virtual const char* get_attribute_type_name( const char* name) const = 0;
487 
499  virtual Sint32 set_attribute_propagation( const char* name, Propagation_type value) = 0;
500 
508  virtual Propagation_type get_attribute_propagation( const char* name) const = 0;
509 
515  virtual const char* enumerate_attributes( Sint32 index) const = 0;
516 };
517  // end group mi_neuray_scene_element
519 
520 } // namespace mi
521 
522 #endif // MI_NEURAYLIB_IATTRIBUTE_SET_H