casa
$Rev:20696$
|
#include <blockio.h>
Public Types | |
enum | IOErrs { OK, NOSUCHFILE, NOMEM, OPENERR, CLOSEERR, READERR, WRITEERR } |
error return code More... | |
Public Member Functions | |
int | err () const |
int | blockno () const |
number of physical blocks read/written | |
void | reset_iosize () |
reset the m_iosize data member | |
int | iosize () const |
get the total bytes of data in m_buffer | |
int | current () const |
get the current read position within m_buffer | |
char * | buffer () const |
get m_buffer | |
int | recno () const |
number of logical records read/written | |
const char * | fname () const |
name of file associated with I/O stream, if applicable | |
int | close_file (fitsfile *fptr, int *status) |
fits_close_file() does not work for reasons that the file pointer does not have the knowledge of chdu which were written with write_hdr() not write_***_hdr(). | |
int | fdes () const |
file descriptor associated with I/O stream, if applicable | |
fitsfile * | getfptr () const |
get the fitsfile pointer | |
void | setfptr (fitsfile *ffp) |
Protected Member Functions | |
BlockIO (const char *, int, int, int=1, FITSErrorHandler errhandler=FITSError::defaultHandler) | |
Construction can be done either from a filename with open options or from a file descriptor. | |
BlockIO (int, int, int=1, FITSErrorHandler errhandler=FITSError::defaultHandler) | |
virtual | ~BlockIO () |
void | errmsg (IOErrs, const char *) |
set the error message and error number for later recovery | |
Protected Attributes | |
char * | m_filename |
int | m_options |
const int | m_recsize |
const int | m_nrec |
const int | m_blocksize |
FITSErrorHandler | m_errfn |
IOErrs | m_err_status |
int | m_fd |
char * | m_buffer |
int | m_block_no |
int | m_rec_no |
int | m_current |
int | m_iosize |
size of record in buffer | |
fitsfile * | m_fptr |
using fitsfile structure from cfitsio of NASA |
fixed-length blocked sequentual I/O base class
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.
casa::BlockIO::BlockIO | ( | const char * | , |
int | , | ||
int | , | ||
int | = 1 , |
||
FITSErrorHandler | errhandler = FITSError::defaultHandler |
||
) | [protected] |
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.
casa::BlockIO::BlockIO | ( | int | , |
int | , | ||
int | = 1 , |
||
FITSErrorHandler | errhandler = FITSError::defaultHandler |
||
) | [protected] |
virtual casa::BlockIO::~BlockIO | ( | ) | [protected, virtual] |
int casa::BlockIO::blockno | ( | ) | const [inline] |
number of physical blocks read/written
Definition at line 69 of file blockio.h.
References m_block_no.
Referenced by casa::FitsInput::blockno().
char* casa::BlockIO::buffer | ( | ) | const [inline] |
int casa::BlockIO::close_file | ( | fitsfile * | fptr, |
int * | status | ||
) |
fits_close_file() does not work for reasons that the file pointer does not have the knowledge of chdu which were written with write_hdr() not write_***_hdr().
So create our own close_file() method.
int casa::BlockIO::current | ( | ) | const [inline] |
int casa::BlockIO::err | ( | ) | const [inline] |
Definition at line 66 of file blockio.h.
References m_err_status.
void casa::BlockIO::errmsg | ( | IOErrs | , |
const char * | |||
) | [protected] |
set the error message and error number for later recovery
int casa::BlockIO::fdes | ( | ) | const [inline] |
const char* casa::BlockIO::fname | ( | ) | const [inline] |
name of file associated with I/O stream, if applicable
Definition at line 87 of file blockio.h.
References m_filename.
fitsfile* casa::BlockIO::getfptr | ( | ) | const [inline] |
int casa::BlockIO::iosize | ( | ) | const [inline] |
int casa::BlockIO::recno | ( | ) | const [inline] |
number of logical records read/written
Definition at line 84 of file blockio.h.
References m_rec_no.
Referenced by casa::FitsInput::recno().
void casa::BlockIO::reset_iosize | ( | ) | [inline] |
void casa::BlockIO::setfptr | ( | fitsfile * | ffp | ) |
int casa::BlockIO::m_block_no [protected] |
const int casa::BlockIO::m_blocksize [protected] |
char* casa::BlockIO::m_buffer [protected] |
int casa::BlockIO::m_current [protected] |
IOErrs casa::BlockIO::m_err_status [protected] |
FITSErrorHandler casa::BlockIO::m_errfn [protected] |
int casa::BlockIO::m_fd [protected] |
char* casa::BlockIO::m_filename [protected] |
fitsfile* casa::BlockIO::m_fptr [protected] |
int casa::BlockIO::m_iosize [protected] |
size of record in buffer
Definition at line 126 of file blockio.h.
Referenced by iosize(), and reset_iosize().
const int casa::BlockIO::m_nrec [protected] |
int casa::BlockIO::m_options [protected] |
int casa::BlockIO::m_rec_no [protected] |
const int casa::BlockIO::m_recsize [protected] |