EleFits  5.0.0
A modern C++ API on top of CFITSIO
Typedefs | Classes | Macros
Binary table data classes

Detailed Description

Binary table data unit containers and tools.

ColumnInfo

ColumnInfo is the simple structure which stores the column metadata:

Column, PtrColumn, VecColumn

A Column is an abstract class composed of a ColumnInfo and some contiguous data. Analogously to Raster, two specializations are provided, and others can be user-defined:

To write a column, any Column implementation works: you can even provide your own, e.g. some EigenColumn. Columns are generally read as VecColumn instances. If you want to give or steal the data to or from a VecColumn, you can exploit move semantics, as shown in the Tutorial:

/* Initialize and later fill a column */
Fits::VecColumn<std::string> stringColumn({"STRING", "unit", 3}, 100);
// String columns must be wide-enough to hold each character.
for (long i = 0; i < stringColumn.rowCount(); ++i) {
stringColumn(i) = std::to_string(i);
}
// operator() takes two parameters: the row index, and repeat index (=0 by default)
/* Create a column from a vector */
// ... do what you have to do with the vector, and then move it to the column ...
Fits::VecColumn<std::int32_t> int32Column({"INT32", "", 1}, std::move(int32Vec));
// Analogously to rasters, columns can be managed with the lightweight PtrColumn classe.
/* Generate a random column */
auto float32Column = Fits::Test::RandomVectorColumn<float>(8, 100);
Binary table column data and metadata.
Definition: Column.h:69
T move(T... args)
T to_string(T... args)

Segment, ColumnKey, TypedKey

The following helpers are defined:

For example, to read several columns of different types, do:

columns.readSeq(as<int>(1), as<float>(3), as<std::string>(8));

instead of:

columns.readSeq<int, float, std::string>({1, 3, 8}); // Error-prone and illegal!

which would be error-prone when reading many columns.

Typedefs

template<typename T , long N = 1>
using PtrColumn = Column< T, N, T * >
 Column which points to some external data (TContainer = T*).
 
template<typename T , long N = 1>
using VecColumn = Column< T, N, std::vector< T > >
 Column which owns a data vector (TContainer = std::vector<T>).
 

Classes

class  Column< T, N, TContainer >
 Binary table column data and metadata. More...
 
struct  ColumnInfo< T, N >
 Column informations, i.e. name, unit, entry shape and value type. More...
 
struct  Segment
 Bounds of a closed index interval. More...
 

Macros

#define ELEFITS_FOREACH_COLUMN_TYPE(MACRO)
 Loop over supported column types. More...