neuray API Programmer's Manual

mi::IData_collection Class Reference

[Collections]

Description

This interface represents collections. All collections are derived from this interface which exposes a generic way to access the data via a key-value or index-value approach. Collections represent an ordered sequence of values. Collections may be typed (all values are of the same type) or untyped.

See Types for description of the type system.

In general, the sets of keys is fixed (additional methods on specific interfaces might insert new keys, e.g., mi::IMap::insert()) and type-specific.

Note that the interface pointers returned from all variants of get_value() are not distinct copies of the values stored inside the collection, but represent the value actually stored in the collection. It is not specified whether the methods set_value() copy the value in their argument or not.

See also:

mi::IData_simple

Public Member Functions

virtual const char* get_key( Size index) const =0
Returns the key corresponding to index. More...
virtual Size get_length() const =0
Returns the number of values.
virtual const base::​IInterfaceget_value( const char* key) const =0
Returns the value for key key. More...
template< class T>const T* get_value( const char* key) const
Returns the value for key key. More...
virtual base::​IInterfaceget_value( const char* key) =0
Returns the value for key key. More...
template< class T>T* get_value( const char* key)
Returns the value for key key. More...
virtual const base::​IInterfaceget_value( Size index) const =0
Returns the value for index index. More...
template< class T>const T* get_value( Size index) const
Returns the value for index index. More...
virtual base::​IInterfaceget_value( Size index) =0
Returns the value for index index. More...
template< class T>T* get_value( Size index)
Returns the value for index index. More...
virtual bool  has_key( const char* key) const =0
Indicates whether the key key exists or not.
virtual Sint32 set_value( const char* key, base::​IInterface* value) =0
Stores the value for key key. More...
virtual Sint32 set_value( Size index, base::​IInterface* value) =0
Stores the value for index index. More...

Member Functions

virtual const char* mi::​IData_collection::get_key( Size index) const [pure virtual]

Returns the key corresponding to index.

Returns

The key, or NULL in case of failure.

virtual Size mi::​IData_collection::get_length() const [pure virtual]

Returns the number of values.

virtual const base::​IInterface* mi::​IData_collection::get_value( const char* key) const [pure virtual]

Returns the value for key key.

Note:

If a literal 0 is passed for key, the call is ambiguous. You need to explicitly cast the argument to const char*.

template< class T>

const T* mi::​IData_collection::get_value( const char* key) const [inline]

Returns the value for key key.

Note:

If a literal 0 is passed for key, the call is ambiguous. You need to explicitly cast the argument to const char*.

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.

virtual base::​IInterface* mi::​IData_collection::get_value( const char* key) [pure virtual]

Returns the value for key key.

Note:

If a literal 0 is passed for key, the call is ambiguous. You need to explicitly cast the argument to const char*.

template< class T>

T* mi::​IData_collection::get_value( const char* key) [inline]

Returns the value for key key.

Note:

If a literal 0 is passed for key, the call is ambiguous. You need to explicitly cast the argument to const char*.

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.

virtual const base::​IInterface* mi::​IData_collection::get_value( Size index) const [pure virtual]

Returns the value for index index.

Note:

If a literal 0 is passed for index, the call is ambiguous. You need to explicitly cast the argument to mi::Size.

template< class T>

const T* mi::​IData_collection::get_value( Size index) const [inline]

Returns the value for index index.

Note:

If a literal 0 is passed for index, the call is ambiguous. You need to explicitly cast the argument to mi::Size.

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.

virtual base::​IInterface* mi::​IData_collection::get_value( Size index) [pure virtual]

Returns the value for index index.

Note:

If a literal 0 is passed for index, the call is ambiguous. You need to explicitly cast the argument to mi::Size.

template< class T>

T* mi::​IData_collection::get_value( Size index) [inline]

Returns the value for index index.

Note:

If a literal 0 is passed for index, the call is ambiguous. You need to explicitly cast the argument to mi::Size.

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.

virtual bool mi::​IData_collection::has_key( const char* key) const [pure virtual]

Indicates whether the key key exists or not.

virtual Sint32 mi::​IData_collection::set_value( const char* key, base::​IInterface* value) [pure virtual]

Stores the value for key key. Note that it is not possible to create new keys.

Note:

If a literal 0 is passed for key, the call is ambiguous. You need to explicitly cast the argument to const char*.

Returns

  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: Invalid key.
  • -3: value has the wrong type.

virtual Sint32 mi::​IData_collection::set_value( Size index, base::​IInterface* value) [pure virtual]

Stores the value for index index. Note that it is not possible to create new indices.

Note:

If a literal 0 is passed for index, the call is ambiguous. You need to explicitly cast the argument to mi::Size.

Returns

  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: Invalid index.
  • -3: value has the wrong type.