neuray API Programmer's Manual

mi::neuraylib::ISerializer Class Reference

[Mi_neuray_dice]

Description

Target for serializing objects to byte streams. The serializer can be used to serialize objects to a byte stream. It is used when serializing objects to disk, to a network connection, etc.

Arrays of values of a particular type can be serialized with a single call by passing the array size as the count parameter. The address of subsequent array elements is obtained by pointer arithmetic.

Public Member Functions

virtual void flush() =0
Flushes the so-far serialized data. More...
virtual void reserve( Size capacity) =0
Gives a hint to the serializer about the required buffer size. More...
virtual bool  serialize( const ISerializable* serializable) =0
Writes a serializable object to the serializer. More...
virtual bool  write( const bool* value, Size count = 1) =0
Writes values of type bool to the serializer. More...
virtual bool  write( const Uint8* value, Size count = 1) =0
Writes values of type mi::Uint8 to the serializer. More...
virtual bool  write( const Uint16* value, Size count = 1) =0
Writes values of type mi::Uint16 to the serializer. More...
virtual bool  write( const Uint32* value, Size count = 1) =0
Writes values of type mi::Size to the serializer. More...
virtual bool  write( const Uint64* value, Size count = 1) =0
Writes values of type mi::Uint64 to the serializer. More...
virtual bool  write( const Sint8* value, Size count = 1) =0
Writes values of type mi::Sint8 to the serializer. More...
virtual bool  write( const Sint16* value, Size count = 1) =0
Writes values of type mi::Sint16 to the serializer. More...
virtual bool  write( const Sint32* value, Size count = 1) =0
Writes values of type mi::Sint32 to the serializer. More...
virtual bool  write( const Sint64* value, Size count = 1) =0
Writes values of type mi::Sint64 to the serializer. More...
virtual bool  write( const Float32* value, Size count = 1) =0
Writes values of type mi::Float32 to the serializer. More...
virtual bool  write( const Float64* value, Size count = 1) =0
Writes values of type mi::Float64 to the serializer. More...
virtual bool  write( const Tag_struct* value, Size count = 1) =0
Writes values of type mi::neuraylib::Tag_struct to the serializer. More...

Member Functions

virtual void mi::​neuraylib::​ISerializer::flush() [pure virtual]

Flushes the so-far serialized data. The meaning of flushing depends on the context in which the serializer is used. If flushing is not supported in some context, nothing happens. If flushing is supported in some context, it typically means to process the already serialized data in the same way as the entire data at the end of the serialization would have been processed. For example, large buffers whose content is produced slowly over time can be subdivided into smaller chunks which can then be processed earlier than the entire buffer.

virtual void mi::​neuraylib::​ISerializer::reserve( Size capacity) [pure virtual]

Gives a hint to the serializer about the required buffer size. Advises the serializer to resize its internal buffer such that it can hold at least capacity additional bytes. This information can be useful to avoid frequent reallocations that might be necessary if large amounts of data are written.

virtual bool mi::​neuraylib::​ISerializer::serialize( const ISerializable* serializable) [pure virtual]

Writes a serializable object to the serializer.

Parameters

serializable
The object to serialize.

Returns

true , unless the class is not registered.

virtual bool mi::​neuraylib::​ISerializer::write( const bool* value, Size count = 1) [pure virtual]

Writes values of type bool to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Uint8* value, Size count = 1) [pure virtual]

Writes values of type mi::Uint8 to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Uint16* value, Size count = 1) [pure virtual]

Writes values of type mi::Uint16 to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Uint32* value, Size count = 1) [pure virtual]

Writes values of type mi::Size to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Uint64* value, Size count = 1) [pure virtual]

Writes values of type mi::Uint64 to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Sint8* value, Size count = 1) [pure virtual]

Writes values of type mi::Sint8 to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Sint16* value, Size count = 1) [pure virtual]

Writes values of type mi::Sint16 to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Sint32* value, Size count = 1) [pure virtual]

Writes values of type mi::Sint32 to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Sint64* value, Size count = 1) [pure virtual]

Writes values of type mi::Sint64 to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Float32* value, Size count = 1) [pure virtual]

Writes values of type mi::Float32 to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Float64* value, Size count = 1) [pure virtual]

Writes values of type mi::Float64 to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)

virtual bool mi::​neuraylib::​ISerializer::write( const Tag_struct* value, Size count = 1) [pure virtual]

Writes values of type mi::neuraylib::Tag_struct to the serializer.

Parameters

value
The address of the values to be written.
count
The number of values to be written.

Returns

true (The method does not fail.)