zSerial Reference

zSerial Reference Members Hierarchy

class EXT_CLASS zSerial

The zSerial class is the base class for serialization to and from standard streams.

zSerial itself does not perform serialization; it simply provides the Load() and Store() virtuals which define the serialization interface can be overridden by derived classes, and provides a number of serialization helpers.

Public Interface

Construction/Destruction

zSerial provides a default constructor, and a virtual destructor.

(public) virtual int Load(istream* istrm);

The Load virtual provides an interface for derived classes to use in serializing from a standard stream.

The result is nonzero if successful, otherwise zero. The default implementation simply returns zero.

(public) virtual int Store(ostream* ostrm);

The Store virtual provides an interface for derived classes to use in serializing to a standard stream.

The result is nonzero if successful, otherwise zero. The default implementation simply returns zero.

Protected Interface

(protected) int streamRead(istream* strm, void* buf, long bufSize);

(protected) int streamRead(istream* strm, char* buf, long bufSize, long& bytesRead);

The streamRead helper reads data from the stream into a buffer.

The first form, which accepts a void* and a buffer-size, reads a fixed amount of data into the buffer provided.

The second form, which accepts a char*, a buffer size, and a bytesRead reference, reads a null-terminated string into the buffer and returns the number of bytes read.

The result is nonzero if successful, otherwise zero.

(protected) int streamWrite(ostream* strm, void* addr, long len);

(protected) int streamWrite(ostream* strm, const char* addr);

The streamWrite helper writes data to the stream.

The first form, which accepts a void* and a length, writes a fixed amount of data from the buffer to the stream.

The second form, which accepts a char*, writes a null-terminated string (including terminator) to the stream.

The result is nonzero if successful, otherwise zero.