OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
epr_typconv.c File Reference
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "epr_api.h"
#include "epr_core.h"
#include "epr_field.h"
Include dependency graph for epr_typconv.c:

Go to the source code of this file.

Functions

char epr_get_field_elem_as_char (const EPR_SField *field, epr_uint elem_index)
 
const char * epr_get_field_elems_char (const EPR_SField *field)
 
epr_uchar epr_get_field_elem_as_uchar (const EPR_SField *field, epr_uint elem_index)
 
const epr_ucharepr_get_field_elems_uchar (const EPR_SField *field)
 
short epr_get_field_elem_as_short (const EPR_SField *field, epr_uint elem_index)
 
const short * epr_get_field_elems_short (const EPR_SField *field)
 
epr_ushort epr_get_field_elem_as_ushort (const EPR_SField *field, epr_uint elem_index)
 
const epr_ushortepr_get_field_elems_ushort (const EPR_SField *field)
 
int epr_get_field_elem_as_int (const EPR_SField *field, epr_uint elem_index)
 
const int * epr_get_field_elems_int (const EPR_SField *field)
 
epr_uint epr_get_field_elem_as_uint (const EPR_SField *field, epr_uint elem_index)
 
const epr_uintepr_get_field_elems_uint (const EPR_SField *field)
 
float epr_get_field_elem_as_float (const EPR_SField *field, epr_uint elem_index)
 
const float * epr_get_field_elems_float (const EPR_SField *field)
 
double epr_get_field_elem_as_double (const EPR_SField *field, epr_uint elem_index)
 
const double * epr_get_field_elems_double (const EPR_SField *field)
 
const EPR_STime * epr_get_field_elem_as_mjd (const EPR_SField *field)
 
const char * epr_get_field_elem_as_str (const EPR_SField *field)
 
epr_uint epr_copy_field_elems_as_doubles (const EPR_SField *field, double *buffer, epr_uint num_elems)
 
epr_uint epr_copy_field_elems_as_floats (const EPR_SField *field, float *buffer, epr_uint num_elems)
 
epr_uint epr_copy_field_elems_as_longs (const EPR_SField *field, int *buffer, epr_uint num_elems)
 
epr_uint epr_copy_field_elems_as_uints (const EPR_SField *field, epr_uint *buffer, epr_uint num_elems)
 

Function Documentation

◆ epr_copy_field_elems_as_doubles()

epr_uint epr_copy_field_elems_as_doubles ( const EPR_SField *  field,
double *  buffer,
epr_uint  num_elems 
)

Copies the data of the given field into the given buffer of double elements. The actual number of elements copied is the minimum of the given number of elements (the buffer's size) and the actual number of elements contained in the field.

If the actual field data type is not double the function automatically performs the conversion.

Parameters
fieldthe field from which to copy the elements
bufferthe buffer in which to copy the data
num_elemsthe number of elements in the given buffer
Returns
the actual number of elements copied

Definition at line 657 of file epr_typconv.c.

◆ epr_copy_field_elems_as_floats()

epr_uint epr_copy_field_elems_as_floats ( const EPR_SField *  field,
float *  buffer,
epr_uint  num_elems 
)

Copies the data of the given field into the given buffer of float elements. The actual number of elements copied is the minimum of the given number of elements (the buffer's size) and the actual number of elements contained in the field.

If the actual field data type is not float the function automatically performs the conversion.

Parameters
fieldthe field from which to copy the elements
bufferthe buffer in which to copy the data
num_elemsthe number of elements in the given buffer
Returns
the actual number of elements copied

Definition at line 729 of file epr_typconv.c.

◆ epr_copy_field_elems_as_longs()

epr_uint epr_copy_field_elems_as_longs ( const EPR_SField *  field,
int *  buffer,
epr_uint  num_elems 
)

Copies the data of the given field into the given buffer of int elements. The actual number of elements copied is the minimum of the given number of elements (the buffer's size) and the actual number of elements contained in the field.

If the actual field data type is not int the function automatically performs the conversion.

Parameters
fieldthe field from which to copy the elements
bufferthe buffer in which to copy the data
num_elemsthe number of elements in the given buffer
Returns
the actual number of elements copied

Definition at line 797 of file epr_typconv.c.

◆ epr_copy_field_elems_as_uints()

epr_uint epr_copy_field_elems_as_uints ( const EPR_SField *  field,
epr_uint buffer,
epr_uint  num_elems 
)

Copies the data of the given field into the given buffer of uint elements. The actual number of elements copied is the minimum of the given number of elements (the buffer's size) and the actual number of elements contained in the field.

If the actual field data type is not uint the function automatically performs the conversion.

Parameters
fieldthe field from which to copy the elements
bufferthe buffer in which to copy the data
num_elemsthe number of elements in the given buffer
Returns
the actual number of elements copied

Definition at line 857 of file epr_typconv.c.

◆ epr_get_field_elem_as_char()

char epr_get_field_elem_as_char ( const EPR_SField *  field,
epr_uint  elem_index 
)

Interpretes a memory as a char value

Parameters
fieldthe pointer at the array to convert
elem_indexthe index of the element in the given array to convert
Returns
the char typed element or error_code if an error occured.

Definition at line 41 of file epr_typconv.c.

◆ epr_get_field_elem_as_double()

double epr_get_field_elem_as_double ( const EPR_SField *  field,
epr_uint  elem_index 
)

Interpretes a memory as a double value

Parameters
fieldthe pointer at the array to convert
elem_indexthe index of the element in the given array to convert
Returns
the double typed element or error_code if an error occured.

Definition at line 514 of file epr_typconv.c.

◆ epr_get_field_elem_as_float()

float epr_get_field_elem_as_float ( const EPR_SField *  field,
epr_uint  elem_index 
)

Interpretes a memory as a float value

Parameters
fieldthe pointer at the array to convert
elem_indexthe index of the element in the given array to convert
Returns
the float typed element or error_code if an error occured.

Definition at line 435 of file epr_typconv.c.

◆ epr_get_field_elem_as_int()

int epr_get_field_elem_as_int ( const EPR_SField *  field,
epr_uint  elem_index 
)

Interpretes a memory as a int value.

If an error occurs the method returns 0 (zero). Whether an error really occured when zero is returned can by determined by using the epr_get_last_err_code function.

Parameters
fieldthe pointer at the array to convert
elem_indexthe index of the element in the given array to convert
Returns
a int value

Definition at line 291 of file epr_typconv.c.

◆ epr_get_field_elem_as_mjd()

const EPR_STime* epr_get_field_elem_as_mjd ( const EPR_SField *  field)

Interpretes a memory data as a short data

Parameters
fieldthe pointer at the array to convert
timethe pointer at the time structure to get
Returns
the time [days, seconds, microseconds] or NULL if an error occured.

Definition at line 596 of file epr_typconv.c.

◆ epr_get_field_elem_as_short()

short epr_get_field_elem_as_short ( const EPR_SField *  field,
epr_uint  elem_index 
)

Interpretes a memory as a short value

Parameters
fieldthe pointer at the array to convert
elem_indexthe index of the element in the given array to convert
Returns
the short typed element or error_code if an error occured.

Definition at line 155 of file epr_typconv.c.

◆ epr_get_field_elem_as_str()

const char* epr_get_field_elem_as_str ( const EPR_SField *  field)

Interpretes a memory data as a string.

Parameters
fieldthe pointer at the array to convert
Returns
the char typed element or NULL if an error occured.

Definition at line 624 of file epr_typconv.c.

◆ epr_get_field_elem_as_uchar()

epr_uchar epr_get_field_elem_as_uchar ( const EPR_SField *  field,
epr_uint  elem_index 
)

Interpretes a memory as a uchar value

Parameters
fieldthe pointer at the array to convert
elem_indexthe index of the element in the given array to convert
Returns
the uchar typed element or error_code if an error occured.

Definition at line 98 of file epr_typconv.c.

◆ epr_get_field_elem_as_uint()

epr_uint epr_get_field_elem_as_uint ( const EPR_SField *  field,
epr_uint  elem_index 
)

Interpretes a memory as a uint value

Parameters
fieldthe pointer at the array to convert
elem_indexthe index of the element in the given array to convert
Returns
the uint typed element or error_code if an error occured.

Definition at line 363 of file epr_typconv.c.

◆ epr_get_field_elem_as_ushort()

epr_ushort epr_get_field_elem_as_ushort ( const EPR_SField *  field,
epr_uint  elem_index 
)

Interpretes a memory as a ushort value

Parameters
fieldthe pointer at the array to convert
elem_indexthe index of the element in the given array to convert
Returns
the ushort typed element or error_code if an error occured.

Definition at line 222 of file epr_typconv.c.

◆ epr_get_field_elems_char()

const char* epr_get_field_elems_char ( const EPR_SField *  field)

Interpretes a memory data as a char data

Parameters
fieldthe pointer at the array to convert
Returns
the char typed element or NULL if an error occured.

Definition at line 71 of file epr_typconv.c.

◆ epr_get_field_elems_double()

const double* epr_get_field_elems_double ( const EPR_SField *  field)

Interpretes a memory data as a double data

Parameters
fieldthe pointer at the array to convert
Returns
the double typed element or NULL if an error occured.

Definition at line 569 of file epr_typconv.c.

◆ epr_get_field_elems_float()

const float* epr_get_field_elems_float ( const EPR_SField *  field)

Interpretes a memory data as a float data

Parameters
fieldthe pointer at the array to convert
Returns
the float typed element or NULL if an error occured.

Definition at line 487 of file epr_typconv.c.

◆ epr_get_field_elems_int()

const int* epr_get_field_elems_int ( const EPR_SField *  field)

Interpretes a memory data as a int data

Parameters
fieldthe pointer at the array to convert
Returns
the int typed element or NULL if an error occured.

Definition at line 336 of file epr_typconv.c.

◆ epr_get_field_elems_short()

const short* epr_get_field_elems_short ( const EPR_SField *  field)

Interpretes a memory data as a short data

Parameters
fieldthe pointer at the array to convert
Returns
the short typed element or NULL if an error occured.

Definition at line 195 of file epr_typconv.c.

◆ epr_get_field_elems_uchar()

const epr_uchar* epr_get_field_elems_uchar ( const EPR_SField *  field)

Interpretes a memory data as a uchar data

Parameters
fieldthe pointer at the array to convert
Returns
the uchar typed element or NULL if an error occured.

Definition at line 128 of file epr_typconv.c.

◆ epr_get_field_elems_uint()

const epr_uint* epr_get_field_elems_uint ( const EPR_SField *  field)

Interpretes a memory data as a uint data

Parameters
fieldthe pointer at the array to convert
Returns
the uint typed element or NULL if an error occured.

Definition at line 408 of file epr_typconv.c.

◆ epr_get_field_elems_ushort()

const epr_ushort* epr_get_field_elems_ushort ( const EPR_SField *  field)

Interpretes a memory data as a ushort data

Parameters
fieldthe pointer at the array to convert
Returns
the ushort typed element or NULL if an error occured.

Definition at line 261 of file epr_typconv.c.