casa
$Rev:20696$
|
Abstract base class for IO of data in a type-dependent format. More...
#include <TypeIO.h>
Public Member Functions | |
TypeIO (ByteIO *byteIO, Bool takeOver=False) | |
Constructor. | |
virtual | ~TypeIO () |
const ByteIO & | byteIO () const |
Functions to return a reference to the ByteIO class. | |
ByteIO & | byteIO () |
virtual uInt | write (uInt nvalues, const Bool *value) |
Convert the values and write them to the ByteIO object. | |
virtual uInt | write (uInt nvalues, const Char *value)=0 |
virtual uInt | write (uInt nvalues, const uChar *value)=0 |
virtual uInt | write (uInt nvalues, const Short *value)=0 |
virtual uInt | write (uInt nvalues, const uShort *value)=0 |
virtual uInt | write (uInt nvalues, const Int *value)=0 |
virtual uInt | write (uInt nvalues, const uInt *value)=0 |
virtual uInt | write (uInt nvalues, const Int64 *value)=0 |
virtual uInt | write (uInt nvalues, const uInt64 *value)=0 |
virtual uInt | write (uInt nvalues, const Float *value)=0 |
virtual uInt | write (uInt nvalues, const Double *value)=0 |
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) |
Read the values from the ByteIO object and convert them. | |
virtual uInt | read (uInt nvalues, Char *value)=0 |
virtual uInt | read (uInt nvalues, uChar *value)=0 |
virtual uInt | read (uInt nvalues, Short *value)=0 |
virtual uInt | read (uInt nvalues, uShort *value)=0 |
virtual uInt | read (uInt nvalues, Int *value)=0 |
virtual uInt | read (uInt nvalues, uInt *value)=0 |
virtual uInt | read (uInt nvalues, Int64 *value)=0 |
virtual uInt | read (uInt nvalues, uInt64 *value)=0 |
virtual uInt | read (uInt nvalues, Float *value)=0 |
virtual uInt | read (uInt nvalues, Double *value)=0 |
virtual uInt | read (uInt nvalues, Complex *value) |
virtual uInt | read (uInt nvalues, DComplex *value) |
virtual uInt | read (uInt nvalues, String *value) |
Int64 | seek (Int64 offset, ByteIO::SeekOption=ByteIO::Begin) |
This function sets the position on the given offset. | |
Int64 | seek (Int offset, ByteIO::SeekOption=ByteIO::Begin) |
Bool | isReadable () const |
Is the TypeIO stream readable? | |
Bool | isWritable () const |
Is the TypeIO stream writable? | |
Bool | isSeekable () const |
Is the TypeIO stream seekable? | |
Protected Member Functions | |
TypeIO (const TypeIO &TypeIO) | |
The copy constructor uses reference semantics. | |
TypeIO & | operator= (const TypeIO &typeIO) |
The assignment operator uses reference semantics. | |
Protected Attributes | |
CountedPtr< ByteIO > | itsByteIO |
This varable keeps a pointer to a ByteIO. |
Abstract base class for IO of data in a type-dependent format.
Public interface
<h3>Review Status</h3><dl><dt>Reviewed By:<dd>Friso Olnon<dt>Date Reviewed:<dd>1996/11/06<dt>Test programs:<dd>tTypeIO</dl>
This class is the abstract base class for doing IO in a type-dependent way. Derived from it are classes like CanonicalIO doing the actual formatting of the data.
The TypeIO classes convert the data to/from the given format using the static conversion functions in the classes like CanonicalConversion . The data is written to or read from the ByteIO object given when constructing the TypeIO object.
TypeIO declares the virtual functions read and write to read/write one or more values of a given data type. Usually the derived classes have to implement these functions. An exception are the functions handling Bool, complex and String values. These functions have a default implementation in this base class. However, if needed they can be overwritten in derived classes.
The base class is needed for polymorphic type-dependent IO. Furthermore the common functionality can be implemented here.
casa::TypeIO::TypeIO | ( | ByteIO * | byteIO, |
Bool | takeOver = False |
||
) | [explicit] |
Constructor.
The read/write functions will use the given ByteIO object as the data store.
virtual casa::TypeIO::~TypeIO | ( | ) | [virtual] |
casa::TypeIO::TypeIO | ( | const TypeIO & | TypeIO | ) | [protected] |
The copy constructor uses reference semantics.
const ByteIO& casa::TypeIO::byteIO | ( | ) | const |
Functions to return a reference to the ByteIO class.
Bool casa::TypeIO::isReadable | ( | ) | const |
Is the TypeIO stream readable?
Bool casa::TypeIO::isSeekable | ( | ) | const |
Is the TypeIO stream seekable?
Bool casa::TypeIO::isWritable | ( | ) | const |
Is the TypeIO stream writable?
The assignment operator uses reference semantics.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
Bool * | value | ||
) | [virtual] |
Read the values from the ByteIO object and convert them.
By default Bools are stored as bits, Complex as 2 floats, DComplex as 2 doubles and String as a length (uInt) and chars. If it does not succeed an exception will be thrown.
Reimplemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
Referenced by casa::StManArrayFile::get().
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
Char * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
uChar * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
Short * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
uShort * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
Int * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
uInt * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
Int64 * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
uInt64 * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
Float * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
Double * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
Complex * | value | ||
) | [virtual] |
Reimplemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
DComplex * | value | ||
) | [virtual] |
Reimplemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::read | ( | uInt | nvalues, |
String * | value | ||
) | [virtual] |
Reimplemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
Int64 casa::TypeIO::seek | ( | Int64 | offset, |
ByteIO::SeekOption | = ByteIO::Begin |
||
) |
This function sets the position on the given offset.
The seek option defines from which file position the seek is done. -1 is returned if not seekable.
Int64 casa::TypeIO::seek | ( | Int | offset, |
ByteIO::SeekOption | = ByteIO::Begin |
||
) |
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const Bool * | value | ||
) | [virtual] |
Convert the values and write them to the ByteIO object.
By default Bools are stored as bits, Complex as 2 floats, DComplex as 2 doubles and String as a length (uInt) and chars. If it does not succeed an exception will be thrown.
Reimplemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
Referenced by casa::StManArrayFile::put().
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const Char * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const uChar * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const Short * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const uShort * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const Int * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const uInt * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const Int64 * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const uInt64 * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const Float * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const Double * | value | ||
) | [pure virtual] |
Implemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const Complex * | value | ||
) | [virtual] |
Reimplemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const DComplex * | value | ||
) | [virtual] |
Reimplemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
virtual uInt casa::TypeIO::write | ( | uInt | nvalues, |
const String * | value | ||
) | [virtual] |
Reimplemented in casa::ConversionIO, casa::CanonicalIO, casa::LECanonicalIO, and casa::RawIO.
CountedPtr<ByteIO> casa::TypeIO::itsByteIO [protected] |