neuray API Programmer's Manual

ideserializer.h File Reference

Description

Deserialization of objects from a byte stream.

Code Example

ideserializer.h

‎//*****************************************************************************
// Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
//*****************************************************************************
//*****************************************************************************

#ifndef MI_NEURAYLIB_IDESERIALIZER_H
#define MI_NEURAYLIB_IDESERIALIZER_H

#include <mi/base/interface_declare.h>
#include <mi/neuraylib/iserializer.h>
#include <mi/neuraylib/version.h>

namespace mi {

namespace neuraylib {









class IDeserializer :
    public base::Interface_declare<0x7052258a,0x579b,0x4861,0x9c,0x12,0x5f,0x02,0x9c,0x86,0xfb,0xce>
{
public:
    virtual ISerializable* deserialize() = 0;

    template <class T>
    T* deserialize()
    {
        ISerializable* ptr_iserializable = deserialize();
        if ( !ptr_iserializable)
            return 0;
        T* ptr_T = static_cast<T*>( ptr_iserializable->get_interface( typename T::IID()));
        ptr_iserializable->release();
        return ptr_T;
    }

    virtual bool read( bool* value, Size count = 1) = 0;

    virtual bool read( Uint8* value, Size count = 1) = 0;

    virtual bool read( Uint16* value, Size count = 1) = 0;

    virtual bool read( Uint32* value, Size count = 1) = 0;

    virtual bool read( Uint64* value, Size count = 1) = 0;

    virtual bool read( Sint8* value, Size count = 1) = 0;

    virtual bool read( Sint16* value, Size count = 1) = 0;

    virtual bool read( Sint32* value, Size count = 1) = 0;

    virtual bool read( Sint64* value, Size count = 1) = 0;

    virtual bool read( Float32* value, Size count = 1) = 0;

    virtual bool read( Float64* value, Size count = 1) = 0;

    virtual bool read( Tag_struct* value, Size count = 1) = 0;
};
 // end group mi_neuray_plugins / mi_neuray_dice

} // namespace neuraylib

#ifdef MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
using neuraylib::IDeserializer;
using neuraylib::ISerializable;
using neuraylib::Tag_struct;
#endif // MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION

} // namespace mi

#endif // MI_NEURAYLIB_IDESERIALIZER_H

Namespaces

namespace 
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
namespace 
Namespace for the neuray API. More...

Classes

class 
Source for deserializing objects from byte streams. More...