casacore
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
casacore::BlockIO Class Reference

fixed-length blocked sequentual I/O base class
More...

#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 More...
 
void reset_iosize ()
 reset the m_iosize data member More...
 
int iosize () const
 get the total bytes of data in m_buffer More...
 
int current () const
 get the current read position within m_buffer More...
 
char * buffer () const
 get m_buffer More...
 
int recno () const
 number of logical records read/written More...
 
const char * fname () const
 name of file associated with I/O stream, if applicable More...
 
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(). More...
 
int fdes () const
 file descriptor associated with I/O stream, if applicable More...
 
fitsfile * getfptr () const
 get the fitsfile pointer More...
 
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. More...
 
 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 More...
 

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 More...
 
fitsfile * m_fptr
 using fitsfile structure from cfitsio of NASA More...
 

Detailed Description

fixed-length blocked sequentual I/O base class


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

Definition at line 61 of file blockio.h.

Member Enumeration Documentation

◆ IOErrs

error return code

Enumerator
OK 
NOSUCHFILE 
NOMEM 
OPENERR 
CLOSEERR 
READERR 
WRITEERR 

Definition at line 64 of file blockio.h.

Constructor & Destructor Documentation

◆ BlockIO() [1/2]

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

◆ BlockIO() [2/2]

casacore::BlockIO::BlockIO ( int  ,
int  ,
int  = 1,
FITSErrorHandler  errhandler = FITSError::defaultHandler 
)
protected

◆ ~BlockIO()

virtual casacore::BlockIO::~BlockIO ( )
protectedvirtual

Member Function Documentation

◆ blockno()

int casacore::BlockIO::blockno ( ) const
inline

number of physical blocks read/written

Definition at line 69 of file blockio.h.

References m_block_no.

Referenced by casacore::FitsInput::blockno().

◆ buffer()

char* casacore::BlockIO::buffer ( ) const
inline

get m_buffer

Definition at line 81 of file blockio.h.

References m_buffer.

◆ close_file()

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

◆ current()

int casacore::BlockIO::current ( ) const
inline

get the current read position within m_buffer

Definition at line 78 of file blockio.h.

References m_current.

◆ err()

int casacore::BlockIO::err ( ) const
inline

Definition at line 66 of file blockio.h.

References m_err_status.

◆ errmsg()

void casacore::BlockIO::errmsg ( IOErrs  ,
const char *   
)
protected

set the error message and error number for later recovery

◆ fdes()

int casacore::BlockIO::fdes ( ) const
inline

file descriptor associated with I/O stream, if applicable

Definition at line 94 of file blockio.h.

References m_fd.

◆ fname()

const char* casacore::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.

◆ getfptr()

fitsfile* casacore::BlockIO::getfptr ( ) const
inline

get the fitsfile pointer

Definition at line 96 of file blockio.h.

References m_fptr.

◆ iosize()

int casacore::BlockIO::iosize ( ) const
inline

get the total bytes of data in m_buffer

Definition at line 75 of file blockio.h.

References m_iosize.

◆ recno()

int casacore::BlockIO::recno ( ) const
inline

number of logical records read/written

Definition at line 84 of file blockio.h.

References m_rec_no.

Referenced by casacore::FitsInput::recno().

◆ reset_iosize()

void casacore::BlockIO::reset_iosize ( )
inline

reset the m_iosize data member

Definition at line 72 of file blockio.h.

References m_iosize.

◆ setfptr()

void casacore::BlockIO::setfptr ( fitsfile *  ffp)

Member Data Documentation

◆ m_block_no

int casacore::BlockIO::m_block_no
protected

Definition at line 122 of file blockio.h.

Referenced by blockno().

◆ m_blocksize

const int casacore::BlockIO::m_blocksize
protected

Definition at line 117 of file blockio.h.

◆ m_buffer

char* casacore::BlockIO::m_buffer
protected

Definition at line 121 of file blockio.h.

Referenced by buffer().

◆ m_current

int casacore::BlockIO::m_current
protected

Definition at line 124 of file blockio.h.

Referenced by current().

◆ m_err_status

IOErrs casacore::BlockIO::m_err_status
protected

Definition at line 119 of file blockio.h.

Referenced by err().

◆ m_errfn

FITSErrorHandler casacore::BlockIO::m_errfn
protected

Definition at line 118 of file blockio.h.

◆ m_fd

int casacore::BlockIO::m_fd
protected

Definition at line 120 of file blockio.h.

Referenced by fdes().

◆ m_filename

char* casacore::BlockIO::m_filename
protected

Definition at line 113 of file blockio.h.

Referenced by fname().

◆ m_fptr

fitsfile* casacore::BlockIO::m_fptr
protected

using fitsfile structure from cfitsio of NASA

Definition at line 128 of file blockio.h.

Referenced by getfptr().

◆ m_iosize

int casacore::BlockIO::m_iosize
protected

size of record in buffer

Definition at line 126 of file blockio.h.

Referenced by iosize(), and reset_iosize().

◆ m_nrec

const int casacore::BlockIO::m_nrec
protected

Definition at line 116 of file blockio.h.

◆ m_options

int casacore::BlockIO::m_options
protected

Definition at line 114 of file blockio.h.

◆ m_rec_no

int casacore::BlockIO::m_rec_no
protected

Definition at line 123 of file blockio.h.

Referenced by recno().

◆ m_recsize

const int casacore::BlockIO::m_recsize
protected

Definition at line 115 of file blockio.h.


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