blockio.h

Classes

BlockIO -- fixed-length blocked sequentual I/O base class (full description)
BlockInput -- fixed-length blocked sequential input base class (full description)
BlockOutput -- fixed-length blocked sequential output base class (full description)

class BlockIO

Types

enum IOErrs

OK
NOSUCHFILE
NOMEM
OPENERR
CLOSEERR
READERR
WRITEERR

Interface

Public Members
int err() const
int blockno() const
int recno() const
const char *fname() const
int fdes() const
Protected Members
BlockIO(const char *, int, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
BlockIO(int, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
virtual ~BlockIO()
void errmsg(IOErrs, char *)
See Also
FitsIO for some BlockIO derived classes.

Description

Synopsis

BlockIO is a low level base class that implements fixed-length blocked sequential I/O. Its derived classes, BlockInput and BlockOutput are used by the FitsInput and FitsOutput classes. Users will hardly ever need to use this class directly.

To Do

Member Description

enum IOErrs

error return code

int err() const

int blockno() const

number of physical blocks read/written

int recno() const

number of logical records read/written

const char *fname() const

name of file associated with I/O stream, if applicable

int fdes() const

file descriptor associated with I/O stream, if applicable

BlockIO(const char *, int, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
BlockIO(int, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
virtual ~BlockIO()

Construction can be done either from a filename with open options or from a file descriptor.

The remaining arguments are the the logical record size and number of records that make up a physical record followed by the output stream that is used to write error messages to.

void errmsg(IOErrs, char *)

set the error message and error number for later recovery


class BlockInput : public BlockIO

Interface

Public Members
BlockInput(const char *, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
BlockInput(int, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
virtual ~BlockInput()
virtual char *read()
virtual char *skip(int)
See Also
FitsInput (click here)

Description

Prerequisite

Member Description

BlockInput(const char *, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
BlockInput(int, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
virtual ~BlockInput()

Construction can be done either from a filename or from a file descriptor.

The remaining arguments are the the logical record size and number of records that make up a physical record followed by the output stream that is used to write error messages to.

virtual char *read()
virtual char *skip(int)

read the next logical record or first skip N logical records and then read the next one. (note it is not possible to skip a record without reading a record).

Caution these functions return a pointer to an internal record. The user must make sure that after destruction of this class no dangling pointers are left.

class BlockOutput : public BlockIO

Interface

BlockOutput(const char *, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
BlockOutput(int, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
virtual ~BlockOutput()
virtual int write(char *)

Description

Prerequisite

Member Description

BlockOutput(const char *, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
BlockOutput(int, int, int = 1, FITSErrorHandler errhandler = FITSError::defaultHandler)
virtual ~BlockOutput()

Construction can be done either from a filename or from a file descriptor.

The remaining arguments are the the logical record size and number of records that make up a physical record followed by the output stream that is used to write error messages to.

virtual int write(char *)

write the next logical record. The input must point to a logical record