EleFits  5.3.0
A modern C++ API on top of CFITSIO
Loading...
Searching...
No Matches
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> string_column({"STRING", "unit", 3}, 100);
// String columns must be wide-enough to hold each character.
for (long i = 0; i < string_column.row_count(); ++i) {
string_column(i) = std::to_string(i);
}
// operator() takes two parameters: the row index, and repeat index (=0 by default)
/* Create a column from a vector */
std::vector<std::int32_t> int32_vec(100);
// ... do what you have to do with the vector, and then move it to the column ...
Fits::VecColumn<std::int32_t> int32_column({"INT32", "", 1}, std::move(int32_vec));
// Analogously to rasters, columns can be managed with the lightweight PtrColumn classe.
/* Generate a random column */
auto float_column = Fits::Test::RandomVectorColumn<float>(8, 100);
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.read_n(as<int>(1), as<float>(3), as<std::string>(8));

instead of:

columns.read_n<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, DataContainerHolder< T, T * > >
 Column which points to some external data (THolder = T*).
 
template<typename T , long N = 1>
using VecColumn = Column< T, N, DataContainerHolder< T, std::vector< T > > >
 Column which owns a data vector (THolder = std::vector<T>).
 

Classes

class  Column< T, N, THolder >
 Binary table column data and metadata. More...
 
struct  ColumnInfo< T, N >
 Column informations, i.e. name, unit, field 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...