iserializer.h File Reference
Description
Serialization of objects to a byte stream.
Code Example
iserializer.h
//*****************************************************************************
// Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
//*****************************************************************************
//*****************************************************************************
#ifndef MI_NEURAYLIB_ISERIALIZER_H
#define MI_NEURAYLIB_ISERIALIZER_H
#include <mi/base/interface_declare.h>
#include <mi/neuraylib/version.h>
namespace mi {
namespace neuraylib {
class ISerializer;
class IDeserializer;
struct Tag_struct
{
Uint32
id;
};
class Tag : public Tag_struct
{
public:
Tag() { id = 0; }
Tag( Tag_struct tag_struct) { id = tag_struct.id; }
bool is_valid() const { return id != 0; }
typedef bool (Tag::*bool_conversion_support)() const;
operator bool_conversion_support() const
{
return is_valid() ? &Tag::is_valid : 0;
}
};
inline bool operator==( const Tag& lhs, const Tag& rhs)
{
return lhs.id == rhs.id;
}
inline bool operator!=( const Tag& lhs, const Tag& rhs)
{
return lhs.id != rhs.id;
}
inline bool operator< ( const Tag& lhs, const Tag& rhs)
{
return lhs.id < rhs.id;
}
inline bool operator>( const Tag& lhs, const Tag& rhs)
{
return lhs.id > rhs.id;
}
inline bool operator< =( const Tag& lhs, const Tag& rhs)
{
return lhs.id <= rhs.id;
}
inline bool operator>=( const Tag& lhs, const Tag& rhs)
{
return lhs.id >= rhs.id;
}
const Tag
NULL_TAG;
// end group mi_neuray_plugins / mi_neuray_dice
class ISerializable :
public base::Interface_declare<0x7a70f2fb,0x1b27,0x416f,0xaa,0x21,0x16,0xc7,0xb4,0xd4,0x1f,0xfc>
{
public:
virtual base::Uuid
get_class_id() const = 0;
virtual void serialize( ISerializer* serializer) const = 0;
virtual void deserialize( IDeserializer* deserializer) = 0;
};
class ISerializer :
public base::Interface_declare<0xdcf5a659,0x2b06,0x436b,0x82,0x55,0x36,0x9d,0xbd,0xe7,0x42,0xb1>
{
public:
virtual bool serialize( const ISerializable* serializable) = 0;
virtual bool write( const bool* value, Size count = 1) = 0;
virtual bool write( const Uint8* value, Size count = 1) = 0;
virtual bool write( const Uint16* value, Size count = 1) = 0;
virtual bool write( const Uint32* value, Size count = 1) = 0;
virtual bool write( const Uint64* value, Size count = 1) = 0;
virtual bool write( const Sint8* value, Size count = 1) = 0;
virtual bool write( const Sint16* value, Size count = 1) = 0;
virtual bool write( const Sint32* value, Size count = 1) = 0;
virtual bool write( const Sint64* value, Size count = 1) = 0;
virtual bool write( const Float32* value, Size count = 1) = 0;
virtual bool write( const Float64* value, Size count = 1) = 0;
virtual void reserve( Size capacity) = 0;
virtual void flush() = 0;
virtual bool write( const 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::ISerializer;
using neuraylib::Tag;
using neuraylib::Tag_struct;
#endif // MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
} // namespace mi
#endif // MI_NEURAYLIB_ISERIALIZER_H
Namespaces
- namespace
- Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
- namespace
- Namespace for the neuray API. More...
Classes
- class
- All serializable objects have to be derived from this interface. More...
- class
- Target for serializing objects to byte streams. More...
- class
- A tag represents a unique identifier for database elements in the database. More...
- struct
- A tag represents a unique identifier for database elements in the database. More...
Functions
- bool ( const Tag& lhs, const Tag& rhs)
- Returns true if lhs is not equal to rhs. More...
- bool ( const Tag& lhs, const Tag& rhs)
- Returns true if lhs is less than rhs. More...
- bool ( const Tag& lhs, const Tag& rhs)
- Returns true if lhs is less than or equal to rhs. More...
- bool ( const Tag& lhs, const Tag& rhs)
- Returns true if lhs is equal to rhs. More...
- bool ( const Tag& lhs, const Tag& rhs)
- Returns true if lhs is greater than rhs. More...
- bool ( const Tag& lhs, const Tag& rhs)
- Returns true if lhs is greater than or equal to rhs. More...
Variables
- const Tag
- This value of the tag represents an invalid tag which can not be accessed. More...