PredicatesΒΆ

libndtypes has a number of type predicates.

int ndt_is_abstract(const ndt_t *t);
int ndt_is_concrete(const ndt_t *t);

Determine whether a type is abstract or concrete. These functions need to be called to check whether the concrete type fields are defined.

int ndt_is_optional(const ndt_t *t);

Check if a type is optional.

int ndt_subtree_is_optional(const ndt_t *t);

Check if a subtree of a type is optional. This is useful for deciding if bitmaps need to be allocated for subtrees.

int ndt_is_ndarray(const ndt_t *t);

Check if a type describes an n-dimensional (n > 0) array of fixed dimensions.

int ndt_is_c_contiguous(const ndt_t *t);
int ndt_is_f_contiguous(const ndt_t *t);

Check if a type is an n-dimensional (n > 0) contiguous C or Fortran array. Currently this returns 0 for scalars.

int ndt_is_scalar(const ndt_t *t);

Check if a type is a scalar.

int ndt_is_signed(const ndt_t *t);
int ndt_is_unsigned(const ndt_t *t);
int ndt_is_float(const ndt_t *t);
int ndt_is_complex(const ndt_t *t);

Check if a type is signed, unsigned, float or complex.

int ndt_endian_is_set(const ndt_t *t);

Check whether the endianness of a type is explicitly set.

int ndt_is_little_endian(const ndt_t *t);
int ndt_is_big_endian(const ndt_t *t);

Check whether a type is big or little endian. Use the native order if no endian flag is set.