EleFits
4.0.1
A modern C++ API on top of CFitsIO
|
#include <HduCategory.h>
An extensible HDU categorization for filtering and iteration.
A category is defined as a sequence of trits (trinary bits), which can take one of two specified values, or be unconstrained. For example, the type of an HDU can be image, binary table or unconstrained.
Predefined trits are provided; user trits can also be added by extending the class.
Predefined categories are provided as static members, e.g. HduCategory::Primary or HduCategory::RawImage. An HduCategory should not be created with a constructor, but rather by combining those categories with (trinary) bitwise operators. For example, an integer-valued, non-empty image extension can be created using one of the following formulae:
Method isInstance is provided to test whether a category validates a model. Yet, in general, Hdu::matches is an adequate shortcut.
More complex, multi-category filters can be created as HduFilter objects.
Classes | |
struct | IncompatibleTrits |
The exception thrown when trying to combine incompatible trits. More... | |
Public Member Functions | |
HduCategory | operator~ () const |
Toggle flags. | |
HduCategory & | operator&= (const HduCategory &rhs) |
Restrict category (constrain flags). | |
HduCategory | operator& (const HduCategory &rhs) const |
Restrict category (constrain flags). More... | |
HduCategory & | operator|= (const HduCategory &rhs) |
Extend category (release flags). | |
HduCategory | operator| (const HduCategory &rhs) const |
Extend category (release flags). More... | |
bool | operator== (const HduCategory &rhs) const |
Equality operator. | |
bool | operator!= (const HduCategory &rhs) const |
Non-equality operator. | |
bool | isInstance (const HduCategory &model) const |
Check whether the category validates (i.e. is more specific than) a given model. | |
Static Public Member Functions | |
template<typename T > | |
static HduCategory | forClass () |
The HDU filter which corresponds to a given HDU handler. More... | |
Static Public Attributes | |
static const HduCategory | Any |
Any HDU. | |
static const HduCategory | Image |
Image HDU. | |
static const HduCategory | Primary |
Primary image HDU. | |
static const HduCategory | Metadata |
HDU without data. | |
static const HduCategory | IntImage |
Integer-valued image HDU. | |
static const HduCategory | RawImage |
Raw (non-compressed) image HDU. | |
static const HduCategory | Ext |
Extension. | |
static const HduCategory | Data |
HDU with data. | |
static const HduCategory | Bintable |
Binary table HDU (necessarily an extension) | |
static const HduCategory | FloatImage |
Real-valued image HDU. | |
static const HduCategory | CompressedImageExt |
Compressed image HDU (effectively written as a binary table extension) | |
static const HduCategory | MetadataPrimary |
Primary HDU without data. | |
static const HduCategory | DataPrimary |
Primary HDU with data. | |
static const HduCategory | IntPrimary |
Integer-valued Primary HDU. | |
static const HduCategory | FloatPrimary |
Real-valued Primary HDU. | |
static const HduCategory | ImageExt |
Image extension. | |
static const HduCategory | MetadataExt |
Extension without data. | |
static const HduCategory | DataExt |
Extension with data. | |
static const HduCategory | IntImageExt |
Image extension with data. | |
static const HduCategory | FloatImageExt |
Image extension without data. | |
static const HduCategory | Untouched |
HDU was not even read. | |
static const HduCategory | Touched |
HDU was at least read. | |
static const HduCategory | Existed |
Pre-existing HDU was opened. | |
static const HduCategory | Created |
HDU was created. | |
static const HduCategory | OnlyRead |
Metadata or data was only read. | |
static const HduCategory | Edited |
Metadata or data was written. | |
Protected Types | |
enum | Trit { Trit::First, Trit::Second, Trit::Unconstrained } |
Trinary values. More... | |
enum | TritPosition { TritPosition::PrimaryExt, TritPosition::MetadataData, TritPosition::ImageBintable, TritPosition::IntFloatImage, TritPosition::RawCompressedImage, TritPosition::UntouchedTouched, TritPosition::ExisitedCreated, TritPosition::ReadEdited, TritPosition::TritCount } |
The positions of the trinary flags. More... | |
Protected Member Functions | |
HduCategory () | |
Create an unconstrained category. | |
HduCategory (TritPosition position, Trit value) | |
Create a category with a single flag constrained. | |
Protected Attributes | |
std::vector< Trit > | m_mask |
The trinary flag mask. More... | |