neuray Services API Programmer's Manual

iconverter.h File Reference

Description

data conversion interface

Code Example

iconverter.h

‎//*****************************************************************************
// Copyright 1986-2011 by mental images GmbH, Fasanenstr. 81, D-10623 Berlin,
// Germany. All rights reserved.
//*****************************************************************************
//*****************************************************************************
#ifndef MI_NSERVICES_ICONVERTER_H
#define MI_NSERVICES_ICONVERTER_H

#include <mi/base/interface_declare.h>
#include <mi/neuraylib/idata.h>

namespace mi {
namespace nservices {






class IConverter : public
    mi::base::Interface_declare<0xBFCB7B23,0xC1D3,0x4863,0xB0,0x20,0x62,0x60,0xE6,0x1C,0xE9,0x23>
{
public:
    virtual IData *convert_to(const IData *from, const char *type_name) = 0;

    template<class T>
    T* convert_to(const IData *from, const char *type_name)
    {
        IData* ptr_idata = convert_to( from, type_name);
        if ( !ptr_idata)
            return 0;
        T* ptr_T = static_cast<T*>( ptr_idata->get_interface( typename T::IID()));
        ptr_idata->release();
        return ptr_T;
    };
};
 // end group mi_nservices_types

} // namespace nservices
} // namespace mi

#endif // MI_NSERVICES_ICONVERTER_H

Namespaces

namespace mi
namespace 
Namespace for the neuray Services API. More...

Classes

class 
Provides the ability to convert between different data types. More...