Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::IAttribute_set Class Referenceabstract

The attribute set comprises all attributes attached to a database element. More...

Inheritance diagram for mi::neuraylib::IAttribute_set:
mi::base::Interface_declare< 0x1bcb8d48, 0x10c1, 0x4b3e, 0x9b, 0xfa, 0x06, 0x23, 0x61, 0x81, 0xd3, 0xe1 > mi::base::IInterface mi::base::Interface_declare< 0x8a2a4da9, 0xe323, 0x452c, 0xb8, 0xda, 0x92, 0x45, 0x67, 0x85, 0xd7, 0x78, neuraylib::IAttribute_set > mi::neuraylib::IScene_element mi::base::Interface_declare< 0x012c847c, 0xaf47, 0x4338, 0xb7, 0xc4, 0x78, 0x67, 0xa3, 0x55, 0x47, 0x18, neuraylib::IScene_element > mi::base::Interface_declare< 0x037ec156, 0x281d, 0x466a, 0xa1, 0x56, 0x3e, 0xd6, 0x83, 0xe9, 0x5a, 0x00, neuraylib::IScene_element > mi::base::Interface_declare< 0x3115ab0f, 0x7a91, 0x4651, 0xa5, 0x9a, 0xfd, 0xb0, 0x23, 0x16, 0xb4, 0xb7, neuraylib::IScene_element > mi::base::Interface_declare< 0x3504744d, 0xd45b, 0x4a99, 0xb6, 0x21, 0x10, 0x9e, 0xd5, 0xcb, 0x36, 0xc1, neuraylib::IScene_element > mi::base::Interface_declare< 0x67b29f5f, 0xdbc1, 0x4300, 0x94, 0x53, 0x3e, 0x2d, 0x28, 0x29, 0xc1, 0xe9, neuraylib::IScene_element > mi::base::Interface_declare< 0x73753e3d, 0x62e4, 0x41a7, 0xa8, 0xf5, 0x37, 0xeb, 0xda, 0xd9, 0x01, 0xd9, neuraylib::IScene_element > mi::base::Interface_declare< 0xa05e5a42, 0x3f74, 0x4ad9, 0x8e, 0xa9, 0x17, 0x4f, 0x97, 0x52, 0x39, 0x8a, neuraylib::IScene_element > mi::base::Interface_declare< 0xa4ac11fd, 0x705d, 0x4a0a, 0x80, 0x0b, 0x38, 0xe5, 0x3d, 0x46, 0x96, 0x47, neuraylib::IScene_element > mi::base::Interface_declare< 0xca59b977, 0x30ee, 0x4172, 0x91, 0x53, 0xb7, 0x70, 0x2c, 0x6b, 0x3a, 0x76, neuraylib::IScene_element > mi::base::Interface_declare< 0xe283b0ee, 0x712b, 0x4bdb, 0xa2, 0x13, 0x32, 0x77, 0x7a, 0x98, 0xf9, 0xa6, neuraylib::IScene_element >

Public Member Functions

virtual IDatacreate_attribute (const char *name, const char *type)=0
 Creates a new attribute name of the type type. More...
 
template<class T >
T * create_attribute (const char *name, const char *type)
 Creates a new attribute name of the type type. More...
 
template<class T >
T * create_attribute (const char *name)
 Creates a new attribute name of the type T. More...
 
virtual bool destroy_attribute (const char *name)=0
 Destroys the attribute name. More...
 
virtual const IDataaccess_attribute (const char *name) const =0
 Returns a const pointer to the attribute name. More...
 
template<class T >
const T * access_attribute (const char *name) const
 Returns a const pointer to the attribute name. More...
 
virtual IDataedit_attribute (const char *name)=0
 Returns a mutable pointer to the attribute name. More...
 
template<class T >
T * edit_attribute (const char *name)
 Returns a mutable pointer to the attribute name. More...
 
virtual bool is_attribute (const char *name) const =0
 Indicates existence of an attribute. More...
 
virtual const char * get_attribute_type_name (const char *name) const =0
 Returns the type of an attribute. More...
 
virtual Sint32 set_attribute_propagation (const char *name, Propagation_type value)=0
 Sets the propagation type of the attribute name. More...
 
virtual Propagation_type get_attribute_propagation (const char *name) const =0
 Returns the propagation type of the attribute name. More...
 
virtual const char * enumerate_attributes (Sint32 index) const =0
 Returns the name of the attribute indicated by index. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x1bcb8d48, 0x10c1, 0x4b3e, 0x9b, 0xfa, 0x06, 0x23, 0x61, 0x81, 0xd3, 0xe1 >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
 Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x1bcb8d48, 0x10c1, 0x4b3e, 0x9b, 0xfa, 0x06, 0x23, 0x61, 0x81, 0xd3, 0xe1 >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

The attribute set comprises all attributes attached to a database element.

Attributes are pieces of information that can be attached to any database element. Basically, an attribute set is a map from attribute names (strings) to attribute values (instances of mi::IData).

Attributes can be inherited in the scene graph. For details, see mi::neuraylib::Propagation_type.

Note
Setting an attribute value is done by value (or deep copy) and not by reference. This is relevant for types that usually follow reference semantics, for example, arrays or structures. Note that references to other DB elements (see mi::IRef) are still stored as reference.

Member Function Documentation

virtual const IData* mi::neuraylib::IAttribute_set::access_attribute ( const char *  name) const
pure virtual

Returns a const pointer to the attribute name.

Parameters
nameThe name of the attribute. In addition, you can also access parts of array or structure attributes directly. For an array element add the index in square brackets to the attribute name. For a structure member add a dot and the name of the structure member to the attribute name.
Returns
A pointer to the attribute, or NULL if there is no attribute with the name name.
template<class T >
const T* mi::neuraylib::IAttribute_set::access_attribute ( const char *  name) const
inline

Returns a const pointer to the attribute name.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid &) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

Template Parameters
TThe interface type of the attribute.
Parameters
nameThe name of the attribute. In addition, you can also access parts of array or structure attributes directly. For an array element add the index in square brackets to the attribute name. For a structure member add a dot and the name of the structure member to the attribute name.
Returns
A pointer to the attribute, or NULL if there is no attribute with the name name or if T does not match the attribute's type.
virtual IData* mi::neuraylib::IAttribute_set::create_attribute ( const char *  name,
const char *  type 
)
pure virtual

Creates a new attribute name of the type type.

Parameters
nameThe name of the attribute. The name must not contain "[", "]", or "."
typeThe type of the attribute. See Types for a list of supported attribute types.
Returns
A pointer to the created attribute, or NULL in case of failure. Reasons for failure are:
  • name or type is invalid,
  • there is already an attribute with the name name, or
  • name is the name of a reserved attribute and type does not match the required type(s) of such an attribute.
template<class T >
T* mi::neuraylib::IAttribute_set::create_attribute ( const char *  name,
const char *  type 
)
inline

Creates a new attribute name of the type type.

See Types for a list of supported attribute types.

Note that there are two versions of this templated member function, one that takes only one argument (the attribute name), and another one that takes two arguments (the attribute name and the type name). The version with one argument can only be used to create a subset of supported attribute types: it supports only those types where the type name can be deduced from the template parameter, i.e., it does not support arrays and structures. The version with two arguments can be used to create attributes of any supported type (but requires the type name as parameter, which for redundant for many types). Attempts to use the version with one argument with a template parameter where the type name can not be deduced results in compiler errors.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid &) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

Template Parameters
TThe interface type of the attribute.
Parameters
nameThe name of the attribute. The name must not contain "[", "]", or "."
typeThe type of the attribute. See Types for a list of supported attribute types.
Returns
A pointer to the created attribute, or NULL in case of failure. Reasons for failure are:
  • name or type is invalid,
  • there is already an attribute with the name name,
  • name is the name of a reserved attribute and type does not match the required type(s) of such an attribute, or
  • T does not match type.
template<class T >
T* mi::neuraylib::IAttribute_set::create_attribute ( const char *  name)
inline

Creates a new attribute name of the type T.

See Types for a list of supported attribute types.

Note that there are two versions of this templated member function, one that takes only one argument (the attribute name), and another one that takes two arguments (the attribute name and the type name). The version with one argument can only be used to create a subset of supported attribute types: it supports only those types where the type name can be deduced from the template parameter, i.e., it does not support arrays and structures. The version with two arguments can be used to create attributes of any supported type (but requires the type name as parameter, which is redundant for many types). Attempts to use the version with one argument with a template parameter where the type name can not be deduced results in compiler errors.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid &) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

Template Parameters
TThe interface type of the attribute.
Parameters
nameThe name of the attribute. The name must not contain "[", "]", or "."
Returns
A pointer to the created attribute, or NULL in case of failure. Reasons for failure are:
  • name or type is invalid,
  • there is already an attribute with the name name, or
  • name is the name of a reserved attribute and T does not match the required type(s) of such an attribute.
virtual bool mi::neuraylib::IAttribute_set::destroy_attribute ( const char *  name)
pure virtual

Destroys the attribute name.

Parameters
nameThe name of the attribute to destroy.
Returns
Returns true if the attribute has been successfully destroyed, and false otherwise (there is no attribute with the name name).
virtual IData* mi::neuraylib::IAttribute_set::edit_attribute ( const char *  name)
pure virtual

Returns a mutable pointer to the attribute name.

Parameters
nameThe name of the attribute. In addition, you can also access parts of array or structure attributes directly. For an array element add the index in square brackets to the attribute name. For a structure member add a dot and the name of the structure member to the attribute name.
Returns
A pointer to the attribute, or NULL if there is no attribute with the name name.
template<class T >
T* mi::neuraylib::IAttribute_set::edit_attribute ( const char *  name)
inline

Returns a mutable pointer to the attribute name.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid &) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

Template Parameters
TThe interface type of the attribute.
Parameters
nameThe name of the attribute. In addition, you can also access parts of array or structure attributes directly. For an array element add the index in square brackets to the attribute name. For a structure member add a dot and the name of the structure member to the attribute name.
Returns
A pointer to the attribute, or NULL if there is no attribute with the name name or if T does not match the attribute's type.
virtual const char* mi::neuraylib::IAttribute_set::enumerate_attributes ( Sint32  index) const
pure virtual

Returns the name of the attribute indicated by index.

Parameters
indexThe index of the attribute.
Returns
The name of the attribute indicated by index, or NULL if index is out of bounds.
virtual Propagation_type mi::neuraylib::IAttribute_set::get_attribute_propagation ( const char *  name) const
pure virtual

Returns the propagation type of the attribute name.

Note
This method always returns PROPAGATION_STANDARD in case of errors.
virtual const char* mi::neuraylib::IAttribute_set::get_attribute_type_name ( const char *  name) const
pure virtual

Returns the type of an attribute.

See Types for a list of supported attribute types.

Parameters
nameThe name of the attribute. In addition, you can also query parts of array or structure attributes directly. For an array element add the index in square brackets to the attribute name. For a structure member add a dot and the name of the structure member to the attribute name.
Returns
The type name of the attribute (or part thereof), or NULL if there is no attribute with the name name.
Note
The return value of this method is only valid until the next call of this method or any non-const methods on this instance.
virtual bool mi::neuraylib::IAttribute_set::is_attribute ( const char *  name) const
pure virtual

Indicates existence of an attribute.

Parameters
nameThe name of the attribute. In addition, you can also checks for parts of array or structure attributes directly. For an array element add the index in square brackets to the attribute name. For a structure member add a dot and the name of the structure member to the attribute name.
Returns
true if the attribute set contains this attribute (and the attribute contains the requested array element or struct member), false otherwise
virtual Sint32 mi::neuraylib::IAttribute_set::set_attribute_propagation ( const char *  name,
Propagation_type  value 
)
pure virtual

Sets the propagation type of the attribute name.

Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer or invalid enum value).
  • -2: There is no attribute with name name.