SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND


Platform::Io
Class ISerializer

NonCopyableType
   |
   +-ISerializer

Implemented in:
Platform.Io.ISerializer.h
Direct Known Subclasses:
FileSerializer, MemorySerializer, NullSerializer

abstract class ISerializer:
private NonCopyableType

A serializer interface.

See Also:
IDeserializer

Field Summarycollapse
protected Int byteCount
          The number of bytes serialized by this stream.

Constructor Summarycollapse
ISerializer()
          Constructor.
~ISerializer() = 0
          Destructor.

Method Summarycollapse
Void close()
          Closes the serializer.
Int count() const
          Retrieves the number of bytes serialized so far by this serializer.
Void flush()
          Flushes the serializer stream.
protected Void serialize(Byte value)
          Serializes a single byte of data.
protected Void serialize(const Void* buffer, Int size)
          Serializes an array of bytes in a byte-order independent manner.
template <typename Type>
ISerializer&
serializeAsByte(const Type& value)
          Serializes a value of a given type as a byte.
template <typename Type>
ISerializer&
serializeAsInt(const Type& value)
          Serializes a value of a given type as a 32-bit integer.
ISerializer& serializeBytes(const Void* buffer, Int size)
          Serializes an array of bytes.

Friend Summarycollapse
friend ISerializer& operator<<(ISerializer& serializer, const Bool& value)
          Serializes a value of type Bool.
friend ISerializer& operator<<(ISerializer& serializer, const Double& value)
          Serializes a value of type Double.
friend ISerializer& operator<<(ISerializer& serializer, const Float& value)
          Serializes a value of type Float.
friend ISerializer& operator<<(ISerializer& serializer, const Int& value)
          Serializes a value of type Int.
friend ISerializer& operator<<(ISerializer& serializer, const LatinChar& value)
          Serializes a value of type LatinChar.
friend ISerializer& operator<<(ISerializer& serializer, const Long& value)
          Serializes a value of type Long.
friend ISerializer& operator<<(ISerializer& serializer, const Short& value)
          Serializes a value of type Short.
friend ISerializer& operator<<(ISerializer& serializer, const Small& value)
          Serializes a value of type Small.
friend ISerializer& operator<<(ISerializer& serializer, const UInt& value)
          Serializes a value of type UInt.
friend ISerializer& operator<<(ISerializer& serializer, const ULong& value)
          Serializes a value of type ULong.
friend ISerializer& operator<<(ISerializer& serializer, const UniChar& value)
          Serializes a value of type UniChar.
friend ISerializer& operator<<(ISerializer& serializer, const UShort& value)
          Serializes a value of type UShort.
friend ISerializer& operator<<(ISerializer& serializer, const USmall& value)
          Serializes a value of type USmall.

 

Field Detail

byteCount

protected Int byteCount

The number of bytes serialized by this stream.

 

Constructor Detail

ISerializer[inline]

ISerializer()

Constructor.


~ISerializer[abstract, inline]

~ISerializer() = 0

Destructor.

 

Method Detail

close[virtual, inline]

Void close()

Closes the serializer. No further serialization must be made by a closed serializer.


count[virtual, inline]

Int count() const

Retrieves the number of bytes serialized so far by this serializer.

Returns:
number of bytes serialized

flush[virtual, inline]

Void flush()

Flushes the serializer stream. Usually implemented by subclasses that cache the serialization stream of bytes in an intermediate storage to write back the cached data to primary store.


serialize[virtual, inline]

protected Void serialize(Byte value)

Serializes a single byte of data.

Parameters:
value - a byte

serialize[virtual, inline]

protected Void serialize(const Void* buffer, Int size)

Serializes an array of bytes in a byte-order independent manner.

Parameters:
buffer - pointer to the array data
size - the size of the array in bytes

serializeAsByte[inline]

template <typename Type>
ISerializer& serializeAsByte(const Type& value)

Serializes a value of a given type as a byte. A conversion between Type and Byte types must be defined. Can be used for serialization of e.g. enumerated types.

Parameters:
value - a value to serialize
Returns:
reference to the serializer

serializeAsInt[inline]

template <typename Type>
ISerializer& serializeAsInt(const Type& value)

Serializes a value of a given type as a 32-bit integer. A conversion between Type and Int types must be defined. Can be used for serialization of e.g. enumerated types.

Parameters:
value - a value to serialize
Returns:
reference to the serializer

serializeBytes[inline]

ISerializer& serializeBytes(const Void* buffer, Int size)

Serializes an array of bytes. The bytes are serialized in order they appear in memory (e.g. no endian conversion). Can be used for serialization of e.g. raw data in memory.

Parameters:
buffer - pointer to the array data
size - the size of the array in bytes
Returns:
reference to the serializer

 

Friend Detail

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const Bool& value)

Serializes a value of type Bool.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const Double& value)

Serializes a value of type Double.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const Float& value)

Serializes a value of type Float.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const Int& value)

Serializes a value of type Int.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const LatinChar& value)

Serializes a value of type LatinChar.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const Long& value)

Serializes a value of type Long.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const Short& value)

Serializes a value of type Short.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const Small& value)

Serializes a value of type Small.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const UInt& value)

Serializes a value of type UInt.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const ULong& value)

Serializes a value of type ULong.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const UniChar& value)

Serializes a value of type UniChar.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const UShort& value)

Serializes a value of type UShort.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer

operator<<[inline]

friend ISerializer& operator<<(ISerializer& serializer, const USmall& value)

Serializes a value of type USmall.

Parameters:
serializer - a serializer to receive the data
value - data to serialize
Returns:
the reference to the serializer


SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND