neuray Services API Programmer's Manual

mi::nservices::IConverter Class Reference

[Types]

Description

Provides the ability to convert between different data types. A converter implementation would typically want to provide conversions between mi::IString and all other mi::IData_simple types as well as all mi::ICompound and mi::IMap. Conversion between compatible mi::ICompound types can also prove useful.

Public Member Functions

virtual IDataconvert_to( const IData* from, const char* type_name) =0
Converts the supplied data to the type specified in type_name. More...
template< class T>T* convert_to( const IData* from, const char* type_name)
Converts the supplied data to the type specified in type_name. More...

Member Functions

virtual IData* mi::​nservices::​IConverter::convert_to( const IData* from, const char* type_name) [pure virtual]

Converts the supplied data to the type specified in type_name. If from is already represented by type_name then it is simply retained and returned.

Parameters

from
the object to convert from.
type_name
the type to convert to.

Returns

the converted type or NULL if the conversion cannot be performed.

template< class T>

T* mi::​nservices::​IConverter::convert_to( const IData* from, const char* type_name) [inline]

Converts the supplied data to the type specified in type_name. If from is already represented by type_name then it is simply retained and returned.

Parameters

from
the object to convert from.
type_name
the type to convert to.

Returns

the converted type or NULL if the conversion cannot be performed.