EleFits  4.0.1
A modern C++ API on top of CFitsIO
Typedefs | Classes | Macros | Functions
Header data classes

Detailed Description

Classes to manipulate the data stored header units.

Record

Template Parameters
TThe value type, which can be an integer, floating point, complex, std::string, const char *, or VariantValue for run-time type deduction.

Here's a record of type double with keyword "LIGHT", value 3.0e8, unit "m/s" and comment "speed of light":

Record<double> lightSpeed { "LIGHT", 3.0e8, "m/s", "speed of light" };

In the Fits file, this record will appear in the header of an HDU as (padding blank spaces removed):

LIGHT = 3.0E8 / [m/s] speed of light

In the Fits definition, it is unclear if the "comment" encompasses only: speed of light, or also the unit, as: [m/s] speed of light. In EleFits, the former is named comment, while the latter is the raw comment. The raw comment can be get as Record::rawComment().

Such a Record can be cast to double (records of value type T can be cast to T), or more precisely, it can be sliced as its value.

double milleniumFalconSpeed = 1.5 * lightSpeed;
// Same as: 1.5 * lightSpeed.value

This is also usefull when aiming at reading record values only, and skip the keyword, unit and comment:

Record<int> theRecord = header.read<int>("KEYWORD");
int theValue = header.read<int>("KEYWORD");

The "HIERARCH" convention for extended keywords is supported. It occurs when the keyword is longer than 8 characters, or contains non-standard characters like spaces or symbols. Such records are read and written transparently as:

HIERARCH the_long_keyword = value / [unit] comment

The maximum length of such a keyword is 67 characters, which gives room for a 1-byte long value.

CFitsIO convention on long string values (more than 68 characters) is supported. When writing a long string record, the value is wrapped automatically, and each new line starts with the CONTINUE keyword. An additional "LONGSTRN" record is written to the file, to warn the file user about the CFitsIO convention.

RecordVec, RecordSeq

Passing a large number of records around can be complex, all the more if the value types are different given how cumbersome it would be to use std::tuple of various Records.

Two record containers are provided to ease this:

Records in those containers are convertible thanks to an internal casting system.

Named

Named is a tool used to robustify the API, for more safety when reading a record (or a column). It conveys alone both the name and type of the record (or the column).

In this context, it is used to write the type close to the name of the record in the function call, that is, writing:

header.parseSeq(Named<int>("A"), Named<float>("B"), Named<std::string>("C"));

instead of:

header.parseSeq<int, float, std::string>({ "A", "B", "C" });

which would be error-prone when reading many records.

Typedefs

using Euclid::Fits::VariantValue = boost::any
 The variant value type for records. More...
 
using Euclid::Fits::RecordSeq = RecordVec< VariantValue >
 A sequence of records of any type.
 

Classes

struct  Euclid::Fits::Record< T >
 Keyword-value pair with optional unit and comment. More...
 
class  Euclid::Fits::RecordVec< T >
 A vector of records with find and conversion services. More...
 

Macros

#define ELEFITS_FOREACH_RECORD_TYPE(MACRO)
 Loop over supported record types. More...
 

Functions

template<typename T >
bool Euclid::Fits::operator!= (const Record< T > &lhs, const Record< T > &rhs)
 Check whether two records are different.
 
std::string
STL class.
std::complex< float >