Module IO
Changes made in the current development cycle can be
found in the changelog.
Basic classes and global functions for IO and object persistency
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
This module provides the basic IO functionality for the AIPS++ classes.
There are two IO mechanisms:
- Class AipsIO
provides the object persistency mechanism.
The templated global functions in
AipsIOCarray.h
form a little layer upon AipsIO. They provide the means to put or
get a C-style array of any type.
- Class ByteSinkSource
and its ancestors provide a general IO mechanism.
Both use the underlying IO framework which define where and how
the data is written. The how-part is defined by classes derived from
TypeIO as shown
in the OMT diagram.
There are three such classes:
- CanonicalIO reads/writes
data in canonical (machine-independent) format. This should be
used when data are meant to be exportable.
It uses the conversion functions in class
CanonicalConversion
.
- RawIO reads/writes
data in native (machine-dependent) format. This can be used when
data are not exported.
- ConversionIO
reads/writes in an external format as defined at construction time.
This can be used when the external format can be one of several
(e.g. VAX or IBM for a WSRT archive tape). In this way the
format has to be defined only once and thereafter is it handled
correctly by the polymorphism mechanism.
The where-part is defined by classes derived from
ByteIO as shown
in the OMT diagram.
There are a few such classes:
- RegularFileIO uses a
regular file to hold the data. Internally it uses FilebufIO (see below).
- FilebufIO uses the
stdio system to do IO in a buffered way. It uses
an internal buffer to do physical IO only when needed. See the
description of C-functions like fopen, fread or do
man stdio for more information.
- FiledesIO uses the
UNIX IO-functions like open, read to do IO directly.
It does not use an internal buffer. Instead it always do a
physical IO. It is meant for IO operations where large chunks of
a file are accessed and for IO on sockets, pipes, etc..
- MemoryIO uses a
(possibly expandable) buffer in memory to hold the data.
The IO framework is easily expandable. Once can for instance think of a
class AsciiIO derived from TypeIO
to hold data in ASCII format.
A class TapeIO could be derived from ByteIO
to access tape files. This class can also contain functions to skip to
a tape file, which the user can call directly.
Similarly a class RemoteTapeIO could be developed.
- AipsIO -- AipsIO is the object persistency mechanism of AIPS++. (full description)
- AipsIOCarray -- Templated functions to get/put a C-style array from/into AipsIO. (full description)
- BaseSinkSource -- Shared base class for ByteSink and ByteSource. (full description)
- BucketCache -- Cache for buckets in a part of a file (full description)
- BucketCache_CallBack -- Define the type of the static read and write function. (full description)
- BucketFile -- File object for the bucket cache. (full description)
- ByteIO -- Abstract base class for IO on a byte stream. (full description)
- ByteSink -- Class for write-only access to data in a given format. (full description)
- ByteSinkSource -- Class for read/write access to data in a given format. (full description)
- ByteSource -- Class for read-only access to data in a given format. (full description)
- CanonicalIO -- Class for IO in canonical format. (full description)
- ConversionIO -- Class for IO in a converted format. (full description)
- FileLocker -- Class to handle file locking. (full description)
- FilebufIO -- Class for buffered file IO. (full description)
- FiledesIO -- Class for IO on a file descriptor. (full description)
- LECanonicalIO -- Class for IO in little endian canonical format. (full description)
- LargeFilebufIO -- Class for buffered IO on a large file. (full description)
- LargeFiledesIO -- Class for IO on a large file descriptor. (full description)
- LargeRegularFileIO -- Class for IO on a regular large file. (full description)
- LockFile -- Class to handle file locking and synchronization. (full description)
- MemoryIO -- Class for IO to a memory buffer. (full description)
- RawIO -- Class for IO in local format. (full description)
- RegularFileIO -- Class for IO on a regular file. (full description)
- StreamIO -- Class for IO on connection oriented socket (full description)
- TapeIO -- Class for IO on a tape device (full description)
- TypeIO -- Abstract base class for IO of data in a type-dependent format (full description)