EleFits  4.0.0
A modern C++ API on top of CFitsIO

◆ accessFirst()

template<class T = Hdu>
const T& Euclid::Fits::MefFile::accessFirst ( const std::string name,
long  version = 0 
)

Access the first HDU with given name, type and version.

Template Parameters
TThe type of HDU, or Hdu to not check the type
Parameters
nameThe HDU name
versionThe HDU version, or 0 to not check the version

The template parameter is used to disambiguate when two extensions of different types have the same name, if set to ImageHdu or BintableHdu. For example, in a file with an image extension and a binary table extension both named "EXT", accessFirst<ImageHdu>("EXT") returns the image extension, while accessFirst<BintableHdu>("EXT") returns the binary table extension, and accessFirst<Hdu>("EXT") returns whichever of the two has the smallest index.

In the case where several HDUs of same type have the same name (which is discouraged by the standard, but not forbidden), method readHduNames() should be used to get the indices and then access(long) should be called.

See also
access(long)
access(const std::string&)