CanonicalIO.h

Classes

CanonicalIO -- Class for IO in canonical format. (full description)

class CanonicalIO: public TypeIO

Interface

Public Members
explicit CanonicalIO (ByteIO* byteIO, uInt bufferLength=4096, Bool takeOver=False)
CanonicalIO (const CanonicalIO& canonicalIO)
CanonicalIO& operator= (const CanonicalIO& canonicalIO)
~CanonicalIO()
virtual uInt write (uInt nvalues, const Bool* value)
virtual uInt write (uInt nvalues, const Char* data)
virtual uInt write (uInt nvalues, const uChar* data)
virtual uInt write (uInt nvalues, const Short* data)
virtual uInt write (uInt nvalues, const uShort* data)
virtual uInt write (uInt nvalues, const Int* data)
virtual uInt write (uInt nvalues, const uInt* data)
virtual uInt write (uInt nvalues, const Int64* data)
virtual uInt write (uInt nvalues, const uInt64* data)
virtual uInt write (uInt nvalues, const Float* data)
virtual uInt write (uInt nvalues, const Double* data)
virtual uInt write (uInt nvalues, const Complex* value)
virtual uInt write (uInt nvalues, const DComplex* value)
virtual uInt write (uInt nvalues, const String* value)
virtual uInt read (uInt nvalues, Bool* value)
virtual uInt read (uInt nvalues, Char* data)
virtual uInt read (uInt nvalues, uChar* data)
virtual uInt read (uInt nvalues, Short* data)
virtual uInt read (uInt nvalues, uShort* data)
virtual uInt read (uInt nvalues, Int* data)
virtual uInt read (uInt nvalues, uInt* data)
virtual uInt read (uInt nvalues, Int64* data)
virtual uInt read (uInt nvalues, uInt64* data)
virtual uInt read (uInt nvalues, Float* data)
virtual uInt read (uInt nvalues, Double* data)
virtual uInt read (uInt nvalues, Complex* value)
virtual uInt read (uInt nvalues, DComplex* value)
virtual uInt read (uInt nvalues, String* value)

Description

Review Status

Reviewed By:
Friso Olnon
Date Reviewed:
1996/11/06
Programs:
Tests:

Prerequisite

Synopsis

CanonicalIO is a specialization of class TypeIO to store data in canonical format.

The class converts the data to/from canonical data and reads/writes them from/into the ByteIO object given at construction time. Conversion is only done when really needed. If not needed, the data is directly read or written.

Canonical format is big-endian IEEE format, where longs are 8 bytes. Bools are stored as bits to be as space-efficient as possible. This means that on a 32-bit SUN or HP conversions only have to be done for Bools and longs. For a DEC-alpha, however, the data will always be converted because it is a little-endian machine.

Member Description

explicit CanonicalIO (ByteIO* byteIO, uInt bufferLength=4096, Bool takeOver=False)

Constructor. The read/write functions will use the given ByteIO object as the data store.

The read and write functions use an intermediate buffer to hold the data in canonical format. For small arrays it uses a fixed buffer with length bufferLength. For arrays not fitting in this buffer, it uses a temporary buffer allocated on the heap.

If takeOver is True the this class will delete the supplied pointer. Otherwise the caller is responsible for this.

CanonicalIO (const CanonicalIO& canonicalIO)

The copy constructor uses reference semantics

CanonicalIO& operator= (const CanonicalIO& canonicalIO)

The assignment operator uses reference semantics

~CanonicalIO()

Destructor, deletes allocated memory.

virtual uInt write (uInt nvalues, const Bool* value)
virtual uInt write (uInt nvalues, const Char* data)
virtual uInt write (uInt nvalues, const uChar* data)
virtual uInt write (uInt nvalues, const Short* data)
virtual uInt write (uInt nvalues, const uShort* data)
virtual uInt write (uInt nvalues, const Int* data)
virtual uInt write (uInt nvalues, const uInt* data)
virtual uInt write (uInt nvalues, const Int64* data)
virtual uInt write (uInt nvalues, const uInt64* data)
virtual uInt write (uInt nvalues, const Float* data)
virtual uInt write (uInt nvalues, const Double* data)
virtual uInt write (uInt nvalues, const Complex* value)
virtual uInt write (uInt nvalues, const DComplex* value)
virtual uInt write (uInt nvalues, const String* value)

Convert the values and write them to the ByteIO object. Bool, complex and String values are handled by the base class.

virtual uInt read (uInt nvalues, Bool* value)
virtual uInt read (uInt nvalues, Char* data)
virtual uInt read (uInt nvalues, uChar* data)
virtual uInt read (uInt nvalues, Short* data)
virtual uInt read (uInt nvalues, uShort* data)
virtual uInt read (uInt nvalues, Int* data)
virtual uInt read (uInt nvalues, uInt* data)
virtual uInt read (uInt nvalues, Int64* data)
virtual uInt read (uInt nvalues, uInt64* data)
virtual uInt read (uInt nvalues, Float* data)
virtual uInt read (uInt nvalues, Double* data)
virtual uInt read (uInt nvalues, Complex* value)
virtual uInt read (uInt nvalues, DComplex* value)
virtual uInt read (uInt nvalues, String* value)

Read the values from the ByteIO object and convert them. Bool, complex and String values are handled by the base class.