OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
epr_bitmask.c File Reference
#include <ctype.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_bitmask.c:

Go to the source code of this file.

Functions

void epr_resolve_bm_ref (EPR_SBmEvalContext *context, EPR_SBmTerm *term)
 
EPR_SBmEvalContext * epr_create_bm_eval_context (EPR_SProductId *product_id, int offset_x, int offset_y, EPR_SRaster *bitmask_raster)
 
void epr_free_bm_eval_context (EPR_SBmEvalContext *context)
 
int epr_read_bitmask_raster (EPR_SProductId *product_id, const char *bm_expr, int offset_x, int offset_y, EPR_SRaster *bm_raster)
 
epr_boolean epr_eval_bm_term (EPR_SBmEvalContext *context, EPR_SBmTerm *term, int x, int y)
 
EPR_SBmTerm * epr_parse_bm_expr_str (const char *bm_expr)
 
EPR_SPtrArray * epr_create_flag_coding (EPR_SProductId *product_id, const char *flag_coding_name)
 
void epr_free_flag_coding (EPR_SPtrArray *flag_coding)
 
EPR_SFlagDef * epr_create_flag_def ()
 
void epr_free_flag_def (EPR_SFlagDef *flag_def)
 
EPR_SBmTerm * epr_parse_bm_expr (EPR_SParseInfo *parse_info, epr_boolean term_required)
 
EPR_SBmTerm * epr_parse_bm_OR_expr (EPR_SParseInfo *parse_info, epr_boolean term_required)
 
EPR_SBmTerm * epr_parse_bm_AND_expr (EPR_SParseInfo *parse_info, epr_boolean term_required)
 
EPR_SBmTerm * epr_parse_bm_unary_expr (EPR_SParseInfo *parse_info, epr_boolean term_required)
 
EPR_SBmTerm * epr_parse_bm_primary_expr (EPR_SParseInfo *parse_info, epr_boolean term_required)
 
epr_boolean epr_is_bm_OR_keyword (EPR_SParseInfo *parse_info)
 
epr_boolean epr_is_bm_AND_keyword (EPR_SParseInfo *parse_info)
 
epr_boolean epr_is_bm_NOT_keyword (EPR_SParseInfo *parse_info)
 
epr_boolean epr_is_bm_AND_operator (EPR_SParseInfo *parse_info)
 
epr_boolean epr_is_bm_OR_operator (EPR_SParseInfo *parse_info)
 
epr_boolean epr_is_bm_NOT_operator (EPR_SParseInfo *parse_info)
 
epr_boolean epr_is_bm_name_token (EPR_SParseInfo *parse_info)
 
epr_boolean epr_is_bm_EOS_token (EPR_SParseInfo *parse_info)
 
epr_boolean epr_is_bm_expr_error (EPR_SParseInfo *parse_info)
 
int epr_get_token_char (EPR_SParseInfo *parse_info)
 
char * epr_consume_token (EPR_SParseInfo *parse_info)
 
void epr_next_bm_expr_token (EPR_SParseInfo *parse_info)
 
void epr_push_back_bm_expr_token (EPR_SParseInfo *parse_info)
 
void epr_set_bm_expr_error (EPR_SParseInfo *parse_info, const char *message)
 
int epr_tokenize_bm_expr (const char *bm_expr, int *bm_expr_pos, char **token)
 
EPR_SBmTerm * epr_create_bm_term (EPR_EBmOpCode op_code)
 
EPR_SBmTerm * epr_create_bm_REF_term (char *band_name, char *flag_name)
 
EPR_SBmTerm * epr_create_bm_NOT_term (EPR_SBmTerm *arg)
 
EPR_SBmTerm * epr_create_bm_OR_term (EPR_SBmTerm *arg1, EPR_SBmTerm *arg2)
 
EPR_SBmTerm * epr_create_bm_AND_term (EPR_SBmTerm *arg1, EPR_SBmTerm *arg2)
 
epr_uint epr_get_pixel_as_uint (const EPR_SRaster *raster, int x, int y)
 
int epr_get_pixel_as_int (const EPR_SRaster *raster, int x, int y)
 
float epr_get_pixel_as_float (const EPR_SRaster *raster, int x, int y)
 
double epr_get_pixel_as_double (const EPR_SRaster *raster, int x, int y)
 
void epr_free_bm_term (EPR_SBmTerm *term)
 
char * epr_create_bm_expr (EPR_SBmTerm *term)
 
void epr_print_bm_term (EPR_SBmTerm *term)
 
void epr_write_bm_term (EPR_SBmTerm *term, FILE *ostream)
 

Function Documentation

◆ epr_consume_token()

char* epr_consume_token ( EPR_SParseInfo *  parse_info)

Releases the actual token given expression.

Parameters
parse_infoparse_info structure
Returns
token

Definition at line 587 of file epr_bitmask.c.

◆ epr_create_bm_AND_term()

EPR_SBmTerm* epr_create_bm_AND_term ( EPR_SBmTerm *  arg1,
EPR_SBmTerm *  arg2 
)

Creates a new bitmask reference AND term instance.

Definition at line 726 of file epr_bitmask.c.

◆ epr_create_bm_eval_context()

EPR_SBmEvalContext* epr_create_bm_eval_context ( EPR_SProductId *  product_id,
int  offset_x,
int  offset_y,
EPR_SRaster *  raster 
)

Creates bit-mask evaluation context for the given raster and offsets of start corner

Parameters
product_idthe product ID
offset_xX-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search
offset_yY-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search
rasterthe bitmask_raster
Returns
bit-mask evaluated context for success, and error code otherwise

Definition at line 39 of file epr_bitmask.c.

◆ epr_create_bm_expr()

char* epr_create_bm_expr ( EPR_SBmTerm *  term)

Creates a new bitmask expression from the given bitmask term.

The expression returned is a valid in the sense that the epr_parse_bm_expr() applied to the returned string would return an equivalent term.

Parameters
termthe term to be converted

Definition at line 880 of file epr_bitmask.c.

◆ epr_create_bm_NOT_term()

EPR_SBmTerm* epr_create_bm_NOT_term ( EPR_SBmTerm *  arg)

Creates a new bitmask NOT term instance.

Definition at line 711 of file epr_bitmask.c.

◆ epr_create_bm_OR_term()

EPR_SBmTerm* epr_create_bm_OR_term ( EPR_SBmTerm *  arg1,
EPR_SBmTerm *  arg2 
)

Creates a new bitmask OR term instance.

Definition at line 718 of file epr_bitmask.c.

◆ epr_create_bm_REF_term()

EPR_SBmTerm* epr_create_bm_REF_term ( char *  ds_name,
char *  flag_name 
)

Creates a new bitmask reference term instance.

Definition at line 701 of file epr_bitmask.c.

◆ epr_create_bm_term()

EPR_SBmTerm* epr_create_bm_term ( EPR_EBmOpCode  op_code)

Creates a new bitmask term instance.

Definition at line 694 of file epr_bitmask.c.

◆ epr_create_flag_coding()

EPR_SPtrArray* epr_create_flag_coding ( EPR_SProductId *  product_id,
const char *  str 
)

Creates the coding flag info

Parameters
strthe local path to dddb
Returns
the the pointer at the coding flag information.

Definition at line 333 of file epr_bitmask.c.

◆ epr_create_flag_def()

EPR_SFlagDef* epr_create_flag_def ( )

Creates the coding flag definition

Returns
the the pointer at the coding flag definition information.

Definition at line 414 of file epr_bitmask.c.

◆ epr_eval_bm_term()

epr_boolean epr_eval_bm_term ( EPR_SBmEvalContext *  context,
EPR_SBmTerm *  term,
int  x,
int  y 
)

Evaluates the given bitmask expression.

Parameters
termthe bitmask term
xthe pixel's x co-ordinate
ythe pixel's y co-ordinate

Definition at line 174 of file epr_bitmask.c.

◆ epr_free_bm_eval_context()

void epr_free_bm_eval_context ( EPR_SBmEvalContext *  context)

Release the memory allocated through a EPR_SBmEvalContext.

Parameters
contextthe bit mask context, if NULL the function immediately returns zero.
Returns
zero for success, an error code otherwise

Definition at line 62 of file epr_bitmask.c.

◆ epr_free_bm_term()

void epr_free_bm_term ( EPR_SBmTerm *  term)

Releases a new bitmask term instance.

Definition at line 844 of file epr_bitmask.c.

◆ epr_free_flag_coding()

void epr_free_flag_coding ( EPR_SPtrArray *  flag_coding)

Releases the coding flag info

Definition at line 395 of file epr_bitmask.c.

◆ epr_free_flag_def()

void epr_free_flag_def ( EPR_SFlagDef *  flag_def)

Releases the coding flag definition

Definition at line 430 of file epr_bitmask.c.

◆ epr_get_token_char()

int epr_get_token_char ( EPR_SParseInfo *  parse_info)

Gets the first character of token for the given expression or EOS.

Parameters
parse_infoparse_info structure
Returns
'(' , ')', '.' , '&' , '|' ,'!', or '\0' otherwise

Definition at line 580 of file epr_bitmask.c.

◆ epr_is_bm_AND_keyword()

epr_boolean epr_is_bm_AND_keyword ( EPR_SParseInfo *  parse_info)

Definition at line 548 of file epr_bitmask.c.

◆ epr_is_bm_AND_operator()

epr_boolean epr_is_bm_AND_operator ( EPR_SParseInfo *  parse_info)

This group of functions is for recognizing the operator.

Parameters
parse_infoparse_info structure
Returns
TRUE or FALSE.

Definition at line 556 of file epr_bitmask.c.

◆ epr_is_bm_EOS_token()

epr_boolean epr_is_bm_EOS_token ( EPR_SParseInfo *  parse_info)

Tests the given expression for the end of string.

Parameters
parse_infoparse_info structure
Returns
TRUE if the EOS occurs, or FALSE otherwise

Definition at line 572 of file epr_bitmask.c.

◆ epr_is_bm_expr_error()

epr_boolean epr_is_bm_expr_error ( EPR_SParseInfo *  parse_info)

Tests the given expression for errors.

Parameters
parse_infoparse_info structure
Returns
TRUE if no error occurs, or FALSE otherwise

Definition at line 576 of file epr_bitmask.c.

◆ epr_is_bm_name_token()

epr_boolean epr_is_bm_name_token ( EPR_SParseInfo *  parse_info)

Tests the given expression for operand name only (not operator).

Parameters
parse_infoparse_info structure
Returns
TRUE if the term is not NULL and an operand, or FALSE otherwise

Definition at line 568 of file epr_bitmask.c.

◆ epr_is_bm_NOT_keyword()

epr_boolean epr_is_bm_NOT_keyword ( EPR_SParseInfo *  parse_info)

Definition at line 552 of file epr_bitmask.c.

◆ epr_is_bm_NOT_operator()

epr_boolean epr_is_bm_NOT_operator ( EPR_SParseInfo *  parse_info)

Definition at line 564 of file epr_bitmask.c.

◆ epr_is_bm_OR_keyword()

epr_boolean epr_is_bm_OR_keyword ( EPR_SParseInfo *  parse_info)

This group of functions is for recognizing the keyword.

Parameters
parse_infoparse_info structure
Returns
TRUE or FALSE.

Definition at line 544 of file epr_bitmask.c.

◆ epr_is_bm_OR_operator()

epr_boolean epr_is_bm_OR_operator ( EPR_SParseInfo *  parse_info)

Definition at line 560 of file epr_bitmask.c.

◆ epr_next_bm_expr_token()

void epr_next_bm_expr_token ( EPR_SParseInfo *  parse_info)

Selectss the next token given expression.

Parameters
parse_infoparse_info structure

Definition at line 597 of file epr_bitmask.c.

◆ epr_parse_bm_AND_expr()

EPR_SBmTerm* epr_parse_bm_AND_expr ( EPR_SParseInfo *  parse_info,
epr_boolean  term_required 
)

Definition at line 471 of file epr_bitmask.c.

◆ epr_parse_bm_expr()

EPR_SBmTerm* epr_parse_bm_expr ( EPR_SParseInfo *  parse_info,
epr_boolean  term_required 
)

This group of functions is for parsing the expression.

Parameters
parse_infoparse_info structure
term_requiredthe boolean value expression.
Returns
the bit mask term (see EPR_BmTerm).

Definition at line 445 of file epr_bitmask.c.

◆ epr_parse_bm_expr_str()

EPR_SBmTerm* epr_parse_bm_expr_str ( const char *  bm_expr)

Parses the bit-mask expression given as character string.

Parameters
bm_exprthe bit-mask expression given as character string
Returns
the bit-mask term tree representing the bit-mask expression
Exceptions
BitmaskExpressionParseExceptionif the given code could not be epr_parse'd
IOExceptionif an I/O error occurs

Definition at line 307 of file epr_bitmask.c.

◆ epr_parse_bm_OR_expr()

EPR_SBmTerm* epr_parse_bm_OR_expr ( EPR_SParseInfo *  parse_info,
epr_boolean  term_required 
)

Definition at line 451 of file epr_bitmask.c.

◆ epr_parse_bm_primary_expr()

EPR_SBmTerm* epr_parse_bm_primary_expr ( EPR_SParseInfo *  parse_info,
epr_boolean  term_required 
)

Definition at line 508 of file epr_bitmask.c.

◆ epr_parse_bm_unary_expr()

EPR_SBmTerm* epr_parse_bm_unary_expr ( EPR_SParseInfo *  parse_info,
epr_boolean  term_required 
)

Definition at line 492 of file epr_bitmask.c.

◆ epr_print_bm_term()

void epr_print_bm_term ( EPR_SBmTerm *  term)

Prints the given term as an expression to the console.

Definition at line 925 of file epr_bitmask.c.

◆ epr_push_back_bm_expr_token()

void epr_push_back_bm_expr_token ( EPR_SParseInfo *  parse_info)

Definition at line 608 of file epr_bitmask.c.

◆ epr_resolve_bm_ref()

void epr_resolve_bm_ref ( EPR_SBmEvalContext *  context,
EPR_SBmTerm *  term 
)

Definition at line 228 of file epr_bitmask.c.

◆ epr_set_bm_expr_error()

void epr_set_bm_expr_error ( EPR_SParseInfo *  parse_info,
const char *  message 
)

Definition at line 612 of file epr_bitmask.c.

◆ epr_tokenize_bm_expr()

int epr_tokenize_bm_expr ( const char *  bm_expr,
int *  bm_expr_pos,
char **  token 
)

Definition at line 635 of file epr_bitmask.c.

◆ epr_write_bm_term()

void epr_write_bm_term ( EPR_SBmTerm *  term,
FILE *  ostream 
)

Writes the given term as an expression to the given output stream.

Definition at line 933 of file epr_bitmask.c.