Loading...
Searching...
No Matches
casacore::TypeIO Class Referenceabstract
casa package (libcasa_casa) » IO_module

More...

`#include <TypeIO.h>`

## Public Member Functions

| TypeIO (const std::shared_ptr< ByteIO > &byteIO)
| Constructor.
virtual | ~TypeIO ()
const ByteIO & | byteIO () const
| Functions to return a reference to the ByteIO class.
ByteIO & | byteIO ()
virtual size_t | write (size_t nvalues, const Bool *value)
| Convert the values and write them to the ByteIO object.
virtual size_t | write (size_t nvalues, const Char *value)=0
virtual size_t | write (size_t nvalues, const uChar *value)=0
virtual size_t | write (size_t nvalues, const Short *value)=0
virtual size_t | write (size_t nvalues, const uShort *value)=0
virtual size_t | write (size_t nvalues, const Int *value)=0
virtual size_t | write (size_t nvalues, const uInt *value)=0
virtual size_t | write (size_t nvalues, const Int64 *value)=0
virtual size_t | write (size_t nvalues, const uInt64 *value)=0
virtual size_t | write (size_t nvalues, const Float *value)=0
virtual size_t | write (size_t nvalues, const Double *value)=0
virtual size_t | write (size_t nvalues, const Complex *value)
virtual size_t | write (size_t nvalues, const DComplex *value)
virtual size_t | write (size_t nvalues, const String *value)
virtual size_t | read (size_t nvalues, Bool *value)
| Read the values from the ByteIO object and convert them.
virtual size_t | read (size_t nvalues, Char *value)=0
virtual size_t | read (size_t nvalues, uChar *value)=0
virtual size_t | read (size_t nvalues, Short *value)=0
virtual size_t | read (size_t nvalues, uShort *value)=0
virtual size_t | read (size_t nvalues, Int *value)=0
virtual size_t | read (size_t nvalues, uInt *value)=0
virtual size_t | read (size_t nvalues, Int64 *value)=0
virtual size_t | read (size_t nvalues, uInt64 *value)=0
virtual size_t | read (size_t nvalues, Float *value)=0
virtual size_t | read (size_t nvalues, Double *value)=0
virtual size_t | read (size_t nvalues, Complex *value)
virtual size_t | read (size_t nvalues, DComplex *value)
virtual size_t | read (size_t 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

std::shared_ptr< ByteIO > | itsByteIO
| This variable keeps a pointer to a ByteIO.

## Detailed Description

Abstract base class for IO of data in a type-dependent format

### Intended use:

Public interface

### Review Status

Reviewed By:
  Friso Olnon
Date Reviewed:
  1996/11/06
Test programs:
  tTypeIO

### Prerequisite

- ByteIO class and derived classes

### Synopsis

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.

### Motivation

The base class is needed for polymorphic type-dependent IO. Furthermore the common functionality can be implemented here.

Definition at line 77 of file TypeIO.h.

## Constructor & Destructor Documentation

## TypeIO() [1/2]

casacore::TypeIO::TypeIO | ( | const std::shared_ptr< ByteIO > & | byteIO | ) |

explicit

Constructor.

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

References byteIO().

Referenced by operator=(), and TypeIO().

## ~TypeIO()

virtual casacore::TypeIO::~TypeIO | ( |  | ) |

virtual

## TypeIO() [2/2]

casacore::TypeIO::TypeIO | ( | const TypeIO & | TypeIO | ) |

protected

The copy constructor uses reference semantics.

References TypeIO().

## Member Function Documentation

## byteIO() [1/2]

ByteIO & casacore::TypeIO::byteIO | ( |  | ) |

## byteIO() [2/2]

const ByteIO & casacore::TypeIO::byteIO | ( |  | ) | const

Functions to return a reference to the ByteIO class.

Referenced by casacore::CanonicalIO::CanonicalIO(), casacore::ConversionIO::ConversionIO(), casacore::LECanonicalIO::LECanonicalIO(), casacore::RawIO::RawIO(), and TypeIO().

## isReadable()

Bool casacore::TypeIO::isReadable | ( |  | ) | const

Is the TypeIO stream readable?

## isSeekable()

Bool casacore::TypeIO::isSeekable | ( |  | ) | const

Is the TypeIO stream seekable?

## isWritable()

Bool casacore::TypeIO::isWritable | ( |  | ) | const

Is the TypeIO stream writable?

## operator=()

TypeIO & casacore::TypeIO::operator= | ( | const TypeIO & | typeIO | ) |

protected

The assignment operator uses reference semantics.

References TypeIO().

## read() [1/14]

virtual size_t casacore::TypeIO::read | ( | size_t | 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 casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [2/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | Char * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [3/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | Complex * | value )

virtual

Reimplemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [4/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | DComplex * | value )

virtual

Reimplemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [5/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | Double * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [6/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | Float * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [7/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | Int * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [8/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | Int64 * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [9/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | Short * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [10/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | String * | value )

virtual

Reimplemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [11/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | uChar * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [12/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | uInt * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [13/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | uInt64 * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## read() [14/14]

virtual size_t casacore::TypeIO::read | ( | size_t | nvalues,
|  | uShort * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## seek() [1/2]

Int64 casacore::TypeIO::seek | ( | Int | offset,
|  | ByteIO::SeekOption | = ByteIO::Begin )

References casacore::ByteIO::Begin, and casacore::offset().

## seek() [2/2]

Int64 casacore::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.

References casacore::ByteIO::Begin, and casacore::offset().

## write() [1/14]

virtual size_t casacore::TypeIO::write | ( | size_t | 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 casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [2/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const Char * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [3/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const Complex * | value )

virtual

Reimplemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [4/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const DComplex * | value )

virtual

Reimplemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [5/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const Double * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [6/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const Float * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [7/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const Int * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [8/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const Int64 * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [9/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const Short * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [10/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const String * | value )

virtual

Reimplemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [11/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const uChar * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [12/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const uInt * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [13/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const uInt64 * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## write() [14/14]

virtual size_t casacore::TypeIO::write | ( | size_t | nvalues,
|  | const uShort * | value )

pure virtual

Implemented in casacore::CanonicalIO, casacore::ConversionIO, casacore::LECanonicalIO, and casacore::RawIO.

References casacore::NewDelAllocator< T >::value.

## Member Data Documentation

## itsByteIO

std::shared_ptr<ByteIO> casacore::TypeIO::itsByteIO

protected

This variable keeps a pointer to a ByteIO.

Definition at line 154 of file TypeIO.h.

The documentation for this class was generated from the following file:

- casa/IO/TypeIO.h