OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
epr_core.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_string.h"
#include "epr_ptrarray.h"
#include "epr_swap.h"
#include "epr_field.h"
#include "epr_record.h"
#include "epr_param.h"
#include "epr_dsd.h"
#include "epr_msph.h"
#include "epr_band.h"
#include "epr_bitmask.h"
#include "epr_dddb.h"
Include dependency graph for epr_core.c:

Go to the source code of this file.

Functions

EPR_EDataTypeId epr_str_to_data_type_id (const char *str)
 
const char * epr_data_type_id_to_str (EPR_EDataTypeId data_type_id)
 
epr_uint epr_get_data_type_size (EPR_EDataTypeId data_type_id)
 
void epr_log (EPR_ELogLevel log_level, const char *log_message)
 
void epr_set_err (EPR_EErrCode err_code, const char *err_message)
 
void epr_clear_err ()
 
EPR_EErrCode epr_get_last_err_code ()
 
const char * epr_get_last_err_message ()
 
FILE * epr_open_file (char *file_path)
 
int epr_str_to_number (const char *str)
 
epr_uint epr_parse_value_count (EPR_SProductId *product_id, const char *count)
 
epr_uint epr_param_to_value (const char *str, EPR_SPtrArray *param_table)
 
void epr_make_os_compatible_path (char *path)
 
epr_boolean epr_check_api_init_flag ()
 

Variables

EPR_SAPI epr_api
 

Function Documentation

◆ epr_check_api_init_flag()

epr_boolean epr_check_api_init_flag ( )

Definition at line 475 of file epr_core.c.

◆ epr_log()

void epr_log ( EPR_ELogLevel  log_level,
const char *  log_message 
)

Logs a message with the given log level.

The function calls this API's log handler if it is not NULL and if the given log level is greater than or equal to the global log level.

Parameters
log_levelthe log level (or message type) for the mesage
log_messagethe mesage

Definition at line 199 of file epr_core.c.

◆ epr_make_os_compatible_path()

void epr_make_os_compatible_path ( char *  path)

Adapts path description to operating system.

Parameters
paththe path to a file.

Definition at line 449 of file epr_core.c.

◆ epr_open_file()

FILE* epr_open_file ( char *  file_path)

Opens a file to read.

Parameters
file_paththe path to the file.
Returns
the file handle or NULL if an error occured.

Definition at line 295 of file epr_core.c.

◆ epr_param_to_value()

epr_uint epr_param_to_value ( const char *  str,
EPR_SPtrArray *  param_table 
)

Finds in the param_table the value corresponding to its name.

Parameters
strthe parameter name
param_tablethe pointer to param_table
Returns
the value of the given name or (uint)-1 if an error occured.

Definition at line 424 of file epr_core.c.

◆ epr_parse_value_count()

epr_uint epr_parse_value_count ( EPR_SProductId *  product_id,
const char *  count 
)

Converts the given string into a field length.

The string can represent a single integer value or a sequence of integer value and parameter references (names). Integers and value are expected to be separated by the asterisk character ('*'). E.g. the string "3 * 4 * num_pixels_across" is represents a valid field length as long as the parameter name 'num_pixels_across' is found in the given parameter table.

Parameters
countthe string to be converted
product_idthe Product identifier containing the values for the Product
Returns
the field length computed from the given string or (uint)-1 if an error occured.

Definition at line 373 of file epr_core.c.

◆ epr_set_err()

void epr_set_err ( EPR_EErrCode  err_code,
const char *  err_message 
)

Sets the given error code and the associated error message and calls this API's error handler if it is not NULL.

Parameters
err_codethe error code
err_messagethe error mesage

Definition at line 221 of file epr_core.c.

◆ epr_str_to_data_type_id()

EPR_EDataTypeId epr_str_to_data_type_id ( const char *  str)

Converts the given string into a data type identifier.

Parameters
strthe string to be converted.
Returns
the data type identifier represented by the given string. If the string can not be converted the special value e_tid_unknown is returned.

Definition at line 58 of file epr_core.c.

◆ epr_str_to_number()

int epr_str_to_number ( const char *  str)

Converts the given string into an int number.

Parameters
strthe string to be converted.
Returns
the int type number represented by the given string. If the string can not be converted, the value of 1 is returned.

Definition at line 328 of file epr_core.c.

Variable Documentation

◆ epr_api

EPR_SAPI epr_api

The one and only ENVISAT API instance.

Definition at line 43 of file epr_core.c.