DiCE API nvidia_logo_transpbg.gif Up
mi::neuraylib::ISerializer Class Referenceabstract

Target for serializing objects to byte streams. More...

#include <iserializer.h>

Inheritance diagram for mi::neuraylib::ISerializer:

Public Member Functions

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 void reserve (Size capacity)=0
 Gives a hint to the serializer about the required buffer size. More...
 
virtual void flush ()=0
 Flushes the so-far serialized data. More...
 
virtual bool write (const Tag_struct *value, Size count=1)=0
 Writes values of type mi::neuraylib::Tag_struct to the serializer. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xdcf5a659, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xdcf5a659, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed 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.

Member Function Documentation

 flush()

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.

 reserve()

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.

 serialize()

virtual bool mi::neuraylib::ISerializer::serialize ( const ISerializable serializable)
pure virtual

Writes a serializable object to the serializer.

Parameters
serializableThe object to serialize.
Returns
true, unless the class is not registered.

 write() [1/12]

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

Writes values of type bool to the serializer.

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [2/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [3/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [4/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [5/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [6/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [7/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [8/12]

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
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [9/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [10/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [11/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)

 write() [12/12]

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

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

Parameters
valueThe address of the values to be written.
countThe number of values to be written.
Returns
true (The method does not fail.)