EleFits
4.0.1
A modern C++ API on top of CFitsIO
|
◆ parseStruct()
template<typename TOut , typename... Ts>
Parse a sequence of records.
Several methods are provided to return records or record values as a user-defined structure, instead of a struct TOut {
T0 p0;
T1 p1;
T2 p2;
};
or a class with such a constructor: TOut::TOut(T0 p0, T1 p1, T2 p2)
where The output structure can be used to mimic a named tuple, which is generally more convenient than a Example usage: struct Body {
int age;
float height;
float mass;
float bmi() const { return mass / (height * height); }
};
// Body can be constructed from a brace-enclosed list:
// Body body { name, age, height, mass };
auto body = hdu.parseStruct<Body>(
Named<std::string>("NAME"),
Named<int>("AGE"),
Named<float>("HEIGHT"),
Named<float>("MASS"));
|