neuray Services API Programmer's Manual

mi::nservices::IUser_type_definition Class Reference

[User Types]

Description

A definition of a user type. IUser_type_definition is used to describe the expected keys in an IUser_type.

Public Member Functions

virtual Sint32 add_element( const char* name, const char* type_name) =0
Adds an element to the user type. More...
virtual const char* get_element_type( const char* name) const =0
Gets the type of an element defined by the user type. More...
virtual bool  get_element_type( Size idx, const char** name, const char** type_name) const =0
Gets the name and type of element idx. More...
virtual const char* get_name() const =0
Returns the name of this user type.
virtual Sint32 set_name( const char* name) =0
Sets the name of this user type. More...

Member Functions

virtual Sint32 mi::​nservices::​IUser_type_definition::add_element( const char* name, const char* type_name) [pure virtual]

Adds an element to the user type. Elements are keyed by a string name and must specify a type. Type can be any one of the base neuray services data types or another registered user type.

Parameters

name
the name of the element
type_name
the type of data stored in the element.

Returns

  • NRS_ERROR_NONE : success.
  • NRS_ERROR_INVALID_PARAMETERS : name or type_name is NULL.
  • NRS_ERROR_INVALID_OPERATION: element name already exists.
virtual const char* mi::​nservices::​IUser_type_definition::get_element_type( const char* name) const [pure virtual]

Gets the type of an element defined by the user type.

Parameters

name
the name of the element

Returns

the type on success, NULL if no element of that name is defined

virtual bool mi::​nservices::​IUser_type_definition::get_element_type( Size idx, const char** name, const char** type_name) const [pure virtual]

Gets the name and type of element idx.

Parameters

idx
index of the parameter to get
name
address in which to store the name of the element, can be NULL
type_name
address in which to store the type name of the element, can be NULL

Returns

true if an element at idx exists, false if idx is > the number of elements

virtual const char* mi::​nservices::​IUser_type_definition::get_name() const [pure virtual]

Returns the name of this user type.

virtual Sint32 mi::​nservices::​IUser_type_definition::set_name( const char* name) [pure virtual]

Sets the name of this user type. Note that user type names are restricted to characters in the set A-Za-z0-9_ and may not start with '_'.

Parameters

name
the name of the user type

Returns

  • NRS_ERROR_NONE : success.
  • NRS_ERROR_INVALID_PARAMETERS : name is NULL or the empty string.
  • NRS_ERROR_INVALID_OPERATION: name contains an invalid character or starts with '_'.