Loading...
Searching...
No Matches
casacore::HeaderDataUnit Class Reference
fits package (libcasa_fits) » FITS_module

More...

`#include <hdu.h>`

## Public Types

enum | HDUErrs { OK , NOMEM , MISSKEY , BADBITPIX , NOAXISN , NOPCOUNT , NOGCOUNT , BADPCOUNT , BADGCOUNT , NOGROUPS , BADNAXIS , BADREC , BADTYPE , BADRULES , BADSIZE , BADOPER , BADCONV , BADIO }
| error handling and error codes that can be returned More...

## Public Member Functions

virtual | ~HeaderDataUnit ()
Int | dims () const
Int | dim (int n) const
OFF_T | fitsdatasize () const
FITS::ValueType | datatype () const
Int | fitsitemsize () const
Int | localitemsize () const
FITS::HDUType | hdutype () const
int | err () const
int | skip (uInt n)
| skipping one or more HDU's
int | skip ()
int | write_hdr (FitsOutput &)
| write the current header
ConstFitsKeywordList & | kwlist ()
| Operations on the HDU's keyword list.
Vector< String > | kwlist_str (Bool length80=False)
| return the header of the chdu as a vector of String.
void | firstkw ()
void | lastkw ()
const FitsKeyword * | nextkw ()
const FitsKeyword * | prevkw ()
const FitsKeyword * | currkw ()
const FitsKeyword * | kw (int n)
const FitsKeyword * | kw (const FITS::ReservedName &n)
const FitsKeyword * | nextkw (FITS::ReservedName &n)
const FitsKeyword * | kw (FITS::ReservedName &n, int i)
const FitsKeyword * | nextkw (FITS::ReservedName &n, int i)
const FitsKeyword * | kw (const char *n)
const FitsKeyword * | nextkw (const char *n)
void | mk (FITS::ReservedName k, Bool v, const char *c=0)
void | mk (FITS::ReservedName k, const char *v=0, const char *c=0)
void | mk (FITS::ReservedName k, Int v, const char *c=0)
void | mk (FITS::ReservedName k, double v, const char *c=0)
void | mk (int n, FITS::ReservedName k, Bool v, const char *c=0)
void | mk (int n, FITS::ReservedName k, const char *v, const char *c=0)
void | mk (int n, FITS::ReservedName k, Int v, const char *c=0)
void | mk (int n, FITS::ReservedName k, double v, const char *c=0)
void | mk (const char *n, Bool v, const char *c=0)
void | mk (const char *n, const char *v=0, const char *c=0)
void | mk (const char *n, Int v, const char *c=0)
void | mk (const char *n, float v, const char *c=0)
void | mk (const char *n, double v, const char *c=0)
void | mk (const char *n, Int r, Int i, const char *c=0)
void | mk (const char *n, float r, float i, const char *c=0)
void | mk (const char *n, double r, double i, const char *c=0)
void | spaces (const char *n=0, const char *c=0)
void | comment (const char *n=0, const char *c=0)
void | history (const char *c=0)
Bool | notnull (double x) const
Bool | notnull (char *s) const
Bool | notnull (Int l) const
int | get_hdr (FITS::HDUType, FitsKeywordList &)
int | read_data (char *, Int)
int | write_data (FitsOutput &, char *, Int)
OFF_T | read_all_data (char *)
int | write_all_data (FitsOutput &, char *)

## Static Public Member Functions

static Bool | determine_type (FitsKeywordList &, FITS::HDUType &, FITS::ValueType &, FITSErrorHandler, HDUErrs &)
| Determines the HDU type and the data type Parameterss: keyword list, hdu type, data type, error handler and error status.
static Bool | compute_size (FitsKeywordList &, OFF_T &, Int &, FITS::HDUType &, FITS::ValueType &, FITSErrorHandler, HDUErrs &)
| Compute the total size of the data associated with an HDU.

## Protected Member Functions

| HeaderDataUnit (FitsInput &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler)
| For input – ~ should delete the keyword list: kwflag = 1.
| HeaderDataUnit (FitsKeywordList &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler, FitsInput *=0)
| For output – ~ should not delete keyword list: kwflag = 0 07/21/98 AKH Clarification: HeaderDataUnit has a copy of the FitsKeywordList, and should delete it.
| HeaderDataUnit (FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler, FitsInput *=0)
| constructor for objects that write only required keyword to fits file.
bool | init_data_unit (FITS::HDUType t)
| for write required keywords only to use.
void | posEnd ()
void | errmsg (HDUErrs, const char *)
char * | assign (FITS::ReservedName)
char * | assign (FITS::ReservedName, int)
double | asgdbl (FITS::ReservedName, double)
double | asgdbl (FITS::ReservedName, int, double)

## Protected Attributes

FitsKeywordList & | kwlist_
ConstFitsKeywordList | constkwlist_
FitsInput * | fin
FITSErrorHandler | errfn
HDUErrs | err_status
Int | no_dims
Int * | dimn
OFF_T | fits_data_size
| uInt fits_data_size; // size in bytes of total amount of data
FITS::ValueType | data_type
Int | fits_item_size
Int | local_item_size
FITS::HDUType | hdu_type
char | pad_char
double | double_null
char | char_null
Int | Int_null

## Friends

std::ostream & | operator<< (std::ostream &o, HeaderDataUnit &h)

## Detailed Description

base class that defines a HDU

### Synopsis

The class HeaderDataUnit contains what is common to all header-data-units, including the collection of keywords. From this class a number of FITS header-data-units are derived, each of them with their own rich assortment of functions for accessing and manipulating data of specific types. The following inheritence hierarchy illustrates the current derived classes:

HeaderDataUnit
/ |
/ |
PrimaryArray ExtensionHeaderDataUnit
/ | \ |
/ | \ |
PrimaryGroup | ImageExtension |
| |
PrimaryTable BinaryTableExtension
/
/
AsciiTableExtension
casacore::AsciiTableExtension
(ascii) TABLE extension
Definition hdu.h:1158
casacore::BinaryTableExtension
BINTABLE extension.
Definition hdu.h:1033
casacore::ExtensionHeaderDataUnit
base class for generalized exentensions HDU
Definition hdu.h:795
casacore::HeaderDataUnit::HeaderDataUnit
HeaderDataUnit(FitsInput &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler)
For input – ~ should delete the keyword list: kwflag = 1.
casacore::ImageExtension
IMAGE extension of given type.
Definition hdu.h:513
casacore::PrimaryGroup
Random Group datastructure.
Definition hdu.h:592
casacore::PrimaryTable
Primary Table structure.
Definition hdu.h:704
casacore::PrimaryArray
PrimaryArray(FitsInput &, FITSErrorHandler=FITSError::defaultHandler)
templated primary array base class of given type

Definition at line 69 of file hdu.h.

## Member Enumeration Documentation

## HDUErrs

enum casacore::HeaderDataUnit::HDUErrs

error handling and error codes that can be returned

Enumerator
OK |
NOMEM |
MISSKEY |
BADBITPIX |
NOAXISN |
NOPCOUNT |
NOGCOUNT |
BADPCOUNT |
BADGCOUNT |
NOGROUPS |
BADNAXIS |
BADREC |
BADTYPE |
BADRULES |
BADSIZE |
BADOPER |
BADCONV |
BADIO |

Definition at line 84 of file hdu.h.

## Constructor & Destructor Documentation

## ~HeaderDataUnit()

virtual casacore::HeaderDataUnit::~HeaderDataUnit | ( |  | ) |

virtual

## HeaderDataUnit() [1/3]

casacore::HeaderDataUnit::HeaderDataUnit | ( | FitsInput & | ,
|  | FITS::HDUType | ,
|  | FITSErrorHandler | errhandler = FITSError::defaultHandler )

protected

For input – ~ should delete the keyword list: kwflag = 1.

References casacore::FITSError::defaultHandler().

Referenced by operator<<.

## HeaderDataUnit() [2/3]

casacore::HeaderDataUnit::HeaderDataUnit | ( | FitsKeywordList & | ,
|  | FITS::HDUType | ,
|  | FITSErrorHandler | errhandler = FITSError::defaultHandler,
|  | FitsInput * | = 0 )

protected

For output – ~ should not delete keyword list: kwflag = 0 07/21/98 AKH Clarification: HeaderDataUnit has a copy of the FitsKeywordList, and should delete it.

The kwflag comments above are not important now.

References casacore::FITSError::defaultHandler().

## HeaderDataUnit() [3/3]

casacore::HeaderDataUnit::HeaderDataUnit | ( | FITS::HDUType | ,
|  | FITSErrorHandler | errhandler = FITSError::defaultHandler,
|  | FitsInput * | = 0 )

protected

constructor for objects that write only required keyword to fits file.

the write method to call by these object should be those for the specific hdu, such as write_bintbl_hdr().

References casacore::FITSError::defaultHandler().

## Member Function Documentation

## asgdbl() [1/2]

double casacore::HeaderDataUnit::asgdbl | ( | FITS::ReservedName | ,
|  | double | )

protected

## asgdbl() [2/2]

double casacore::HeaderDataUnit::asgdbl | ( | FITS::ReservedName | ,
|  | int | ,
|  | double | )

protected

## assign() [1/2]

char * casacore::HeaderDataUnit::assign | ( | FITS::ReservedName |  | ) |

protected

## assign() [2/2]

char * casacore::HeaderDataUnit::assign | ( | FITS::ReservedName | ,
|  | int | )

protected

## comment()

void casacore::HeaderDataUnit::comment | ( | const char * | n = 0,
|  | const char * | c = 0 )

inline

Definition at line 257 of file hdu.h.

References kwlist_, and posEnd().

## compute_size()

Bool casacore::HeaderDataUnit::compute_size | ( | FitsKeywordList & | ,
|  | OFF_T & | ,
|  | Int & | ,
|  | FITS::HDUType & | ,
|  | FITS::ValueType & | ,
|  | FITSErrorHandler | ,
|  | HDUErrs & | )

static

Compute the total size of the data associated with an HDU.

The number of dimensions is also determined. This routine assumes that hdu type has been appropriately set, but it may be changed in the process. Data type is also determined. Returns False if a serious error was detected, otherwise True

## currkw()

const FitsKeyword * casacore::HeaderDataUnit::currkw | ( |  | ) |

inline

Definition at line 126 of file hdu.h.

References kwlist_.

## datatype()

FITS::ValueType casacore::HeaderDataUnit::datatype | ( |  | ) | const

inline

Definition at line 77 of file hdu.h.

References data_type.

## determine_type()

Bool casacore::HeaderDataUnit::determine_type | ( | FitsKeywordList & | ,
|  | FITS::HDUType & | ,
|  | FITS::ValueType & | ,
|  | FITSErrorHandler | ,
|  | HDUErrs & | )

static

Determines the HDU type and the data type Parameterss: keyword list, hdu type, data type, error handler and error status.

Returns False if a serious error was detected, otherwise True

## dim()

Int casacore::HeaderDataUnit::dim | ( | int | n | ) | const

inline

Definition at line 75 of file hdu.h.

References dimn, and no_dims.

Referenced by casacore::BinaryTableExtension::nrows().

## dims()

Int casacore::HeaderDataUnit::dims | ( |  | ) | const

inline

Definition at line 74 of file hdu.h.

References no_dims.

## err()

int casacore::HeaderDataUnit::err | ( |  | ) | const

inline

Definition at line 88 of file hdu.h.

References err_status.

## errmsg()

void casacore::HeaderDataUnit::errmsg | ( | HDUErrs | ,
|  | const char * | )

protected

## firstkw()

void casacore::HeaderDataUnit::firstkw | ( |  | ) |

inline

Definition at line 122 of file hdu.h.

References kwlist_.

## fitsdatasize()

OFF_T casacore::HeaderDataUnit::fitsdatasize | ( |  | ) | const

inline

Definition at line 76 of file hdu.h.

References fits_data_size.

## fitsitemsize()

Int casacore::HeaderDataUnit::fitsitemsize | ( |  | ) | const

inline

Definition at line 78 of file hdu.h.

References fits_item_size.

## get_hdr()

int casacore::HeaderDataUnit::get_hdr | ( | FITS::HDUType | ,
|  | FitsKeywordList & | )

## hdutype()

FITS::HDUType casacore::HeaderDataUnit::hdutype | ( |  | ) | const

inline

Definition at line 80 of file hdu.h.

References hdu_type.

## history()

void casacore::HeaderDataUnit::history | ( | const char * | c = 0 | ) |

inline

Definition at line 259 of file hdu.h.

References kwlist_, and posEnd().

## init_data_unit()

bool casacore::HeaderDataUnit::init_data_unit | ( | FITS::HDUType | t | ) |

protected

for write required keywords only to use.

## kw() [1/4]

const FitsKeyword * casacore::HeaderDataUnit::kw | ( | const char * | n | ) |

inline

Definition at line 137 of file hdu.h.

References kwlist_.

## kw() [2/4]

const FitsKeyword * casacore::HeaderDataUnit::kw | ( | const FITS::ReservedName & | n | ) |

inline

Definition at line 129 of file hdu.h.

References kwlist_.

## kw() [3/4]

const FitsKeyword * casacore::HeaderDataUnit::kw | ( | FITS::ReservedName & | n,
|  | int | i )

inline

Definition at line 133 of file hdu.h.

References kwlist_.

## kw() [4/4]

const FitsKeyword * casacore::HeaderDataUnit::kw | ( | int | n | ) |

inline

Definition at line 127 of file hdu.h.

References kwlist_.

## kwlist()

ConstFitsKeywordList & casacore::HeaderDataUnit::kwlist | ( |  | ) |

inline

Operations on the HDU's keyword list.

Definition at line 118 of file hdu.h.

References constkwlist_.

## kwlist_str()

Vector< String > casacore::HeaderDataUnit::kwlist_str | ( | Bool | length80 = False | ) |

return the header of the chdu as a vector of String.

You can force the strings to be length 80 (padded with spaces)

References casacore::False.

## lastkw()

void casacore::HeaderDataUnit::lastkw | ( |  | ) |

inline

Definition at line 123 of file hdu.h.

References kwlist_.

## localitemsize()

Int casacore::HeaderDataUnit::localitemsize | ( |  | ) | const

inline

Definition at line 79 of file hdu.h.

References local_item_size.

## mk() [1/16]

void casacore::HeaderDataUnit::mk | ( | const char * | n,
|  | Bool | v,
|  | const char * | c = 0 )

inline

Definition at line 239 of file hdu.h.

References kwlist_, and posEnd().

## mk() [2/16]

void casacore::HeaderDataUnit::mk | ( | const char * | n,
|  | const char * | v = 0,
|  | const char * | c = 0 )

inline

Definition at line 241 of file hdu.h.

References kwlist_, and posEnd().

## mk() [3/16]

void casacore::HeaderDataUnit::mk | ( | const char * | n,
|  | double | r,
|  | double | i,
|  | const char * | c = 0 )

inline

Definition at line 253 of file hdu.h.

References kwlist_, and posEnd().

## mk() [4/16]

void casacore::HeaderDataUnit::mk | ( | const char * | n,
|  | double | v,
|  | const char * | c = 0 )

inline

Definition at line 247 of file hdu.h.

References kwlist_, and posEnd().

## mk() [5/16]

void casacore::HeaderDataUnit::mk | ( | const char * | n,
|  | float | r,
|  | float | i,
|  | const char * | c = 0 )

inline

Definition at line 251 of file hdu.h.

References kwlist_, and posEnd().

## mk() [6/16]

void casacore::HeaderDataUnit::mk | ( | const char * | n,
|  | float | v,
|  | const char * | c = 0 )

inline

Definition at line 245 of file hdu.h.

References kwlist_, and posEnd().

## mk() [7/16]

void casacore::HeaderDataUnit::mk | ( | const char * | n,
|  | Int | r,
|  | Int | i,
|  | const char * | c = 0 )

inline

Definition at line 249 of file hdu.h.

References kwlist_, and posEnd().

## mk() [8/16]

void casacore::HeaderDataUnit::mk | ( | const char * | n,
|  | Int | v,
|  | const char * | c = 0 )

inline

Definition at line 243 of file hdu.h.

References kwlist_, and posEnd().

## mk() [9/16]

void casacore::HeaderDataUnit::mk | ( | FITS::ReservedName | k,
|  | Bool | v,
|  | const char * | c = 0 )

inline

Definition at line 223 of file hdu.h.

References kwlist_, and posEnd().

## mk() [10/16]

void casacore::HeaderDataUnit::mk | ( | FITS::ReservedName | k,
|  | const char * | v = 0,
|  | const char * | c = 0 )

inline

Definition at line 225 of file hdu.h.

References kwlist_, and posEnd().

## mk() [11/16]

void casacore::HeaderDataUnit::mk | ( | FITS::ReservedName | k,
|  | double | v,
|  | const char * | c = 0 )

inline

Definition at line 229 of file hdu.h.

References kwlist_, and posEnd().

## mk() [12/16]

void casacore::HeaderDataUnit::mk | ( | FITS::ReservedName | k,
|  | Int | v,
|  | const char * | c = 0 )

inline

Definition at line 227 of file hdu.h.

References kwlist_, and posEnd().

## mk() [13/16]

void casacore::HeaderDataUnit::mk | ( | int | n,
|  | FITS::ReservedName | k,
|  | Bool | v,
|  | const char * | c = 0 )

inline

Definition at line 231 of file hdu.h.

References kwlist_, and posEnd().

## mk() [14/16]

void casacore::HeaderDataUnit::mk | ( | int | n,
|  | FITS::ReservedName | k,
|  | const char * | v,
|  | const char * | c = 0 )

inline

Definition at line 233 of file hdu.h.

References kwlist_, and posEnd().

## mk() [15/16]

void casacore::HeaderDataUnit::mk | ( | int | n,
|  | FITS::ReservedName | k,
|  | double | v,
|  | const char * | c = 0 )

inline

Definition at line 237 of file hdu.h.

References kwlist_, and posEnd().

## mk() [16/16]

void casacore::HeaderDataUnit::mk | ( | int | n,
|  | FITS::ReservedName | k,
|  | Int | v,
|  | const char * | c = 0 )

inline

Definition at line 235 of file hdu.h.

References kwlist_, and posEnd().

## nextkw() [1/4]

const FitsKeyword * casacore::HeaderDataUnit::nextkw | ( |  | ) |

inline

Definition at line 124 of file hdu.h.

References kwlist_.

## nextkw() [2/4]

const FitsKeyword * casacore::HeaderDataUnit::nextkw | ( | const char * | n | ) |

inline

Definition at line 138 of file hdu.h.

References kwlist_.

## nextkw() [3/4]

const FitsKeyword * casacore::HeaderDataUnit::nextkw | ( | FITS::ReservedName & | n | ) |

inline

Definition at line 131 of file hdu.h.

References kwlist_.

## nextkw() [4/4]

const FitsKeyword * casacore::HeaderDataUnit::nextkw | ( | FITS::ReservedName & | n,
|  | int | i )

inline

Definition at line 135 of file hdu.h.

References kwlist_.

## notnull() [1/3]

Bool casacore::HeaderDataUnit::notnull | ( | char * | s | ) | const

inline

Definition at line 161 of file hdu.h.

References casacore::False, and casacore::True.

## notnull() [2/3]

Bool casacore::HeaderDataUnit::notnull | ( | double | x | ) | const

inline

Definition at line 160 of file hdu.h.

References double_null, casacore::False, and casacore::True.

## notnull() [3/3]

Bool casacore::HeaderDataUnit::notnull | ( | Int | l | ) | const

inline

Definition at line 162 of file hdu.h.

References casacore::False, Int_null, and casacore::True.

## posEnd()

void casacore::HeaderDataUnit::posEnd | ( |  | ) |

protected

Referenced by comment(), history(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), and spaces().

## prevkw()

const FitsKeyword * casacore::HeaderDataUnit::prevkw | ( |  | ) |

inline

Definition at line 125 of file hdu.h.

References kwlist_.

## read_all_data()

OFF_T casacore::HeaderDataUnit::read_all_data | ( | char * |  | ) |

## read_data()

int casacore::HeaderDataUnit::read_data | ( | char * | ,
|  | Int | )

Referenced by casacore::ExtensionHeaderDataUnit::read().

## skip() [1/2]

int casacore::HeaderDataUnit::skip | ( |  | ) |

## skip() [2/2]

int casacore::HeaderDataUnit::skip | ( | uInt | n | ) |

skipping one or more HDU's

## spaces()

void casacore::HeaderDataUnit::spaces | ( | const char * | n = 0,
|  | const char * | c = 0 )

inline

Definition at line 255 of file hdu.h.

References kwlist_, and posEnd().

## write_all_data()

int casacore::HeaderDataUnit::write_all_data | ( | FitsOutput & | ,
|  | char * | )

## write_data()

int casacore::HeaderDataUnit::write_data | ( | FitsOutput & | ,
|  | char * | ,
|  | Int | )

Referenced by casacore::ExtensionHeaderDataUnit::write().

## write_hdr()

int casacore::HeaderDataUnit::write_hdr | ( | FitsOutput & |  | ) |

write the current header

## Friends And Related Symbol Documentation

## operator<<

std::ostream & operator<< | ( | std::ostream & | o,
|  | HeaderDataUnit & | h )

friend

Definition at line 221 of file hdu.h.

References HeaderDataUnit(), and kwlist_.

## Member Data Documentation

## char_null

char casacore::HeaderDataUnit::char_null

protected

Definition at line 210 of file hdu.h.

## constkwlist_

ConstFitsKeywordList casacore::HeaderDataUnit::constkwlist_

protected

Definition at line 185 of file hdu.h.

Referenced by kwlist().

## data_type

FITS::ValueType casacore::HeaderDataUnit::data_type

protected

Definition at line 197 of file hdu.h.

Referenced by datatype().

## dimn

Int* casacore::HeaderDataUnit::dimn

protected

Definition at line 194 of file hdu.h.

Referenced by dim().

## double_null

double casacore::HeaderDataUnit::double_null

protected

Definition at line 209 of file hdu.h.

Referenced by notnull().

## err_status

HDUErrs casacore::HeaderDataUnit::err_status

protected

Definition at line 190 of file hdu.h.

Referenced by err().

## errfn

FITSErrorHandler casacore::HeaderDataUnit::errfn

protected

Definition at line 189 of file hdu.h.

## fin

FitsInput* casacore::HeaderDataUnit::fin

protected

Definition at line 188 of file hdu.h.

## fits_data_size

OFF_T casacore::HeaderDataUnit::fits_data_size

protected

uInt fits_data_size; // size in bytes of total amount of data

Definition at line 196 of file hdu.h.

Referenced by fitsdatasize().

## fits_item_size

Int casacore::HeaderDataUnit::fits_item_size

protected

Definition at line 198 of file hdu.h.

Referenced by fitsitemsize().

## hdu_type

FITS::HDUType casacore::HeaderDataUnit::hdu_type

protected

Definition at line 200 of file hdu.h.

Referenced by hdutype().

## Int_null

Int casacore::HeaderDataUnit::Int_null

protected

Definition at line 211 of file hdu.h.

Referenced by notnull().

## kwlist_

FitsKeywordList& casacore::HeaderDataUnit::kwlist_

protected

Definition at line 184 of file hdu.h.

Referenced by comment(), currkw(), firstkw(), history(), kw(), kw(), kw(), kw(), lastkw(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), mk(), nextkw(), nextkw(), nextkw(), nextkw(), operator<<, prevkw(), and spaces().

## local_item_size

Int casacore::HeaderDataUnit::local_item_size

protected

Definition at line 199 of file hdu.h.

Referenced by localitemsize().

## no_dims

Int casacore::HeaderDataUnit::no_dims

protected

Definition at line 193 of file hdu.h.

Referenced by dim(), and dims().

## pad_char

char casacore::HeaderDataUnit::pad_char

protected

Definition at line 201 of file hdu.h.

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

- fits/FITS/hdu.h