Loading...
Searching...
No Matches
Type codes

## Functions

const char * | cpl_type_get_name (cpl_type type)
| Get a string with the name of a type, e.g. "char", "int", "float".
size_t | cpl_type_get_sizeof (cpl_type type)
| Compute the size of a type.

enum

_cpl_type_ {
CPL_TYPE_FLAG_ARRAY ,
CPL_TYPE_INVALID ,
CPL_TYPE_CHAR ,
CPL_TYPE_UCHAR ,
CPL_TYPE_BOOL ,
CPL_TYPE_SHORT ,
CPL_TYPE_USHORT ,
CPL_TYPE_INT ,
CPL_TYPE_UINT ,
CPL_TYPE_LONG ,
CPL_TYPE_ULONG ,
CPL_TYPE_LONG_LONG ,
CPL_TYPE_SIZE ,
CPL_TYPE_FLOAT ,
CPL_TYPE_DOUBLE ,
CPL_TYPE_POINTER ,
CPL_TYPE_COMPLEX ,
CPL_TYPE_UNSPECIFIED ,
CPL_TYPE_BITMASK ,
CPL_TYPE_STRING ,
CPL_TYPE_FLOAT_COMPLEX ,
CPL_TYPE_DOUBLE_COMPLEX
}

| The CPL type codes and flags. More...
typedef enum _cpl_type_ | cpl_type
| The type code type.
typedef long long | cpl_size
| The type used for sizes and indices in CPL.
typedef uint64_t | cpl_bitmask
| The CPL bitmask type for bitmask operations.
#define | CPL_SIZE_MIN
| Minimum value a variable of type cpl_size can hold.
#define | CPL_SIZE_MAX
| Maximum value a variable of type cpl_size can hold.
#define | CPL_SIZE_FORMAT
| The format specifier for the type cpl_size.

## Detailed Description

This module provides codes for the basic types (including `char`, `int`, `float`, etc.) used in CPL. These type codes may be used to indicate the type of a value stored in another object, the value of a property or the pixel of an image for instance. In addition, a utility function is provided to compute the size, which is required to store a value of the type indicated by a given type code.

The module

Synopsis
  #include <cpl_type.h>

## Macro Definition Documentation

## CPL_SIZE_FORMAT

#define CPL_SIZE_FORMAT

The format specifier for the type cpl_size.

Note
  It is "ld" when cpl_size is a `long` int and "d" when it is an `int`

See also
  cpl_size

It can be used like this:

cpl_size i = my_index();
return cpl_sprintf("The index is %" CPL_SIZE_FORMAT "\n", i);
cpl_sprintf
char * cpl_sprintf(const char *format,...)
Create a string and fill it in an sprintf()-like manner.
Definition cpl_memory.c:386
CPL_SIZE_FORMAT
#define CPL_SIZE_FORMAT
The format specifier for the type cpl_size.
Definition cpl_type.h:280
cpl_size
long long cpl_size
The type used for sizes and indices in CPL.
Definition cpl_type.h:210

Referenced by cpl_apertures_dump(), cpl_array_dump(), cpl_array_dump_structure(), cpl_flux_get_noise_ring(), cpl_frameset_labelise(), cpl_geom_img_offset_combine(), cpl_geom_img_offset_fine(), cpl_image_dump_structure(), cpl_image_dump_window(), cpl_imagelist_load_frameset(), cpl_mask_dump_window(), cpl_matrix_decomp_chol(), cpl_matrix_dump(), cpl_matrix_fill_diagonal(), cpl_matrix_get_determinant(), cpl_plot_bivector(), cpl_plot_bivectors(), cpl_plot_columns(), cpl_plot_image(), cpl_plot_image_col(), cpl_plot_image_row(), cpl_plot_mask(), cpl_plot_vector(), cpl_plot_vectors(), cpl_polynomial_dump(), cpl_polynomial_fit(), cpl_polynomial_get_coeff(), cpl_polynomial_set_coeff(), cpl_propertylist_dump(), cpl_stats_dump(), cpl_table_dump(), cpl_table_dump_structure(), cpl_table_get(), cpl_table_get_complex(), cpl_table_get_int(), cpl_test_end(), cpl_vector_dump(), cpl_vector_load(), cpl_vector_new(), cpl_vector_wrap(), and cpl_wcs_platesol().

## CPL_SIZE_MAX

#define CPL_SIZE_MAX

Maximum value a variable of type cpl_size can hold.

## CPL_SIZE_MIN

#define CPL_SIZE_MIN

Minimum value a variable of type cpl_size can hold.

## Typedef Documentation

## cpl_bitmask

typedef uint64_t cpl_bitmask

The CPL bitmask type for bitmask operations.

Note
  The CPL bitmask is currently used only for bit-wise operations on CPL images of integer pixel type, which are 32-bits wide. For forward compatibility the CPL bitmask is 64 bits wide, which is cast to 32 bits when used with a CPL_TYPE_INT.

## cpl_size

cpl_image cpl_size

The type used for sizes and indices in CPL.

## cpl_type

typedef enum _cpl_type_ cpl_type

The type code type.

## Enumeration Type Documentation

## _cpl_type_

enum _cpl_type_

The CPL type codes and flags.

Enumerator
CPL_TYPE_FLAG_ARRAY | Flag indicating whether a type is an array or a basic type.
CPL_TYPE_INVALID | Invalid or undetermined type.
CPL_TYPE_CHAR | Type code corresponding to type `char`.
CPL_TYPE_UCHAR | Type code corresponding to type `unsigned` char.
CPL_TYPE_BOOL | Type code corresponding to the boolean type.
CPL_TYPE_SHORT | Type code corresponding to type `short`.
CPL_TYPE_USHORT | Type code corresponding to type `unsigned` short.
CPL_TYPE_INT | Type code corresponding to type `int`.
CPL_TYPE_UINT | Type code corresponding to type `unsigned` int.
CPL_TYPE_LONG | Type code corresponding to type `long`.
CPL_TYPE_ULONG | Type code corresponding to type `unsigned` long.
CPL_TYPE_LONG_LONG | Type code corresponding to type `long` `long`.
CPL_TYPE_SIZE | Type code corresponding to type `cpl_size`
CPL_TYPE_FLOAT | Type code corresponding to type `float`.
CPL_TYPE_DOUBLE | Type code corresponding to type `double`.
CPL_TYPE_POINTER | Type code corresponding to a pointer type.
CPL_TYPE_COMPLEX | Type code corresponding to a complex type.
CPL_TYPE_UNSPECIFIED | Type code to be used for inheritance of original FITS type.
CPL_TYPE_BITMASK | Type code corresponding to type `cpl_bitmask`
CPL_TYPE_STRING | Type code corresponding to a character array.
CPL_TYPE_FLOAT_COMPLEX | Type code corresponding to type `float` complex.
CPL_TYPE_DOUBLE_COMPLEX | Type code corresponding to type `double` complex.

## Function Documentation

## cpl_type_get_name()

const char * cpl_type_get_name | ( | cpl_type | type | ) |

Get a string with the name of a type, e.g. "char", "int", "float".

Parameters

  type | Type code to be evaluated.

Returns
  A pointer to a string literal with the name or empty string on error.

References CPL_ERROR_INVALID_TYPE, CPL_TYPE_BOOL, CPL_TYPE_CHAR, CPL_TYPE_DOUBLE, CPL_TYPE_DOUBLE_COMPLEX, CPL_TYPE_FLAG_ARRAY, CPL_TYPE_FLOAT, CPL_TYPE_FLOAT_COMPLEX, CPL_TYPE_INT, CPL_TYPE_INVALID, CPL_TYPE_LONG, CPL_TYPE_LONG_LONG, CPL_TYPE_POINTER, CPL_TYPE_SHORT, CPL_TYPE_SIZE, CPL_TYPE_STRING, CPL_TYPE_UCHAR, CPL_TYPE_UINT, CPL_TYPE_ULONG, CPL_TYPE_UNSPECIFIED, and CPL_TYPE_USHORT.

Referenced by cpl_array_new(), cpl_dfs_setup_product_header(), cpl_fit_image_gaussian(), cpl_image_and(), cpl_image_and_scalar(), cpl_image_cast(), cpl_image_dump_structure(), cpl_image_exponential(), cpl_image_hypot(), cpl_image_logarithm(), cpl_image_not(), cpl_image_or(), cpl_image_or_scalar(), cpl_image_power(), cpl_image_xor(), cpl_image_xor_scalar(), cpl_parameter_get_bool(), cpl_parameter_get_default_bool(), cpl_parameter_get_default_double(), cpl_parameter_get_default_int(), cpl_parameter_get_default_string(), cpl_parameter_get_double(), cpl_parameter_get_enum_double(), cpl_parameter_get_enum_int(), cpl_parameter_get_enum_size(), cpl_parameter_get_enum_string(), cpl_parameter_get_int(), cpl_parameter_get_range_max_double(), cpl_parameter_get_range_max_int(), cpl_parameter_get_range_min_double(), cpl_parameter_get_range_min_int(), cpl_parameter_get_string(), cpl_parameter_new_enum(), cpl_parameter_new_enum_from_array(), cpl_parameter_new_range(), cpl_parameter_new_value(), cpl_parameter_set_bool(), cpl_parameter_set_default_bool(), cpl_parameter_set_default_double(), cpl_parameter_set_default_int(), cpl_parameter_set_default_string(), cpl_parameter_set_double(), cpl_parameter_set_int(), cpl_parameter_set_string(), cpl_property_delete(), cpl_property_get_bool(), cpl_property_get_char(), cpl_property_get_double(), cpl_property_get_double_complex(), cpl_property_get_float(), cpl_property_get_float_complex(), cpl_property_get_int(), cpl_property_get_long(), cpl_property_get_long_long(), cpl_property_get_string(), cpl_property_set_bool(), cpl_property_set_char(), cpl_property_set_double(), cpl_property_set_double_complex(), cpl_property_set_float(), cpl_property_set_float_complex(), cpl_property_set_int(), cpl_property_set_long(), cpl_property_set_long_long(), cpl_property_set_string(), cpl_propertylist_dump(), cpl_table_get(), cpl_table_get_complex(), and cpl_table_get_int().

## cpl_type_get_sizeof()

size_t cpl_type_get_sizeof | ( | cpl_type | type | ) |

Compute the size of a type.

Parameters

  type | Type code to be evaluated.

Returns
  The size of the fundamental type, or 0 in case an invalid type code was given.

The function computes the atomic size of the type type. The result for fundamental types like `CPL_TYPE_FLOAT` is what you would expect from the C sizeof() operator. For arrays, i.e. types having the `CPL_TYPE_FLAG_ARRAY` set the returned size is not the size of a pointer to `CPL_TYPE_FLOAT` for instance, but the size of its fundamental type, i.e. the returned size is same as for the type `CPL_TYPE_FLOAT`.

Especially for the type `CPL_TYPE_STRING`, which is explicitly defined for convenience reasons, the size returned by this function is the size of `CPL_TYPE_CHAR!`

References CPL_TYPE_BOOL, CPL_TYPE_CHAR, CPL_TYPE_DOUBLE, CPL_TYPE_DOUBLE_COMPLEX, CPL_TYPE_FLAG_ARRAY, CPL_TYPE_FLOAT, CPL_TYPE_FLOAT_COMPLEX, CPL_TYPE_INT, CPL_TYPE_INVALID, CPL_TYPE_LONG, CPL_TYPE_LONG_LONG, CPL_TYPE_POINTER, CPL_TYPE_SHORT, CPL_TYPE_SIZE, CPL_TYPE_UCHAR, CPL_TYPE_UINT, CPL_TYPE_ULONG, CPL_TYPE_UNSPECIFIED, and CPL_TYPE_USHORT.

Referenced by cpl_fit_imagelist_polynomial_window(), cpl_image_and(), cpl_image_and_scalar(), cpl_image_cast(), cpl_image_copy(), cpl_image_duplicate(), cpl_image_filter(), cpl_image_filter_mask(), cpl_image_not(), cpl_image_or(), cpl_image_or_scalar(), cpl_image_shift(), cpl_image_xor(), cpl_image_xor_scalar(), cpl_parameter_new_enum_from_array(), cpl_property_delete(), cpl_property_get_double(), cpl_property_get_double_complex(), cpl_property_get_float(), cpl_property_get_float_complex(), cpl_property_set_bool(), cpl_property_set_char(), cpl_property_set_double(), cpl_property_set_double_complex(), cpl_property_set_float(), cpl_property_set_float_complex(), cpl_property_set_int(), cpl_property_set_long(), cpl_property_set_long_long(), and cpl_test_get_bytes_image().