ConversionIO.h

Classes

ConversionIO -- Class for IO in a converted format. (full description)

class ConversionIO: public TypeIO

Interface

Public Members
ConversionIO (DataConversion* dataConversion, ByteIO* byteIO, uInt bufferLength=4096, Bool takeOver=False)
ConversionIO (const ConversionIO& conversionIO)
ConversionIO& operator= (const ConversionIO& conversionIO)
~ConversionIO()
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)
Private Members
void init()

Description

Review Status

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

Prerequisite

Synopsis

ConversionIO is a specialization of class TypeIO to store data in a converted format.

The class converts the data to/from external 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.

This class is useful when data can be stored in one of multiple formats. Only at construction time the correct DataConversion class has to be given. Thereafter polymorphism ensures that the correct conversion is done when reading or writing.

Member Description

ConversionIO (DataConversion* dataConversion, ByteIO* byteIO, uInt bufferLength=4096, Bool takeOver=False)

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

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 this this class will be responsible for deleting the DataConversion and ByteIO pointers. Otherwise it is the callers responsibility.

ConversionIO (const ConversionIO& conversionIO)

The copy constructor uses reference semantics

ConversionIO& operator= (const ConversionIO& conversionIO)

The assignment operator uses reference semantics

~ConversionIO()

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.

void init()

Initialize the itsSize and itsCopy variables.