|
ocssw
V2022
|
Go to the source code of this file.
Classes | |
| struct | EPR_SBmTerm |
| struct | EPR_SBmEvalContext |
| struct | EPR_SBmFlagDataset |
| struct | EPR_SParseInfo |
Macros | |
| #define | FLAG_MASK_NOT_COMPUTED ((epr_uint) -1) |
Typedefs | |
| typedef enum EPR_BmOpCode | EPR_EBmOpCode |
Enumerations | |
| enum | EPR_BmOpCode { BMT_UNKNOWN = 0, BMT_REF, BMT_AND, BMT_OR, BMT_NOT } |
| enum | EPR_Tok { BME_UNKNOWN = 0, BME_EOS, BME_SPECIAL, BME_NAME } |
Functions | |
| EPR_SBmEvalContext * | epr_create_bm_eval_context (EPR_SProductId *product_id, int offset_x, int offset_y, EPR_SRaster *raster) |
| void | epr_free_bm_eval_context (EPR_SBmEvalContext *context) |
| int | epr_read_bitmask_data (const EPR_SProductId *product_id, const char *bm_expr, int xo, int yo, int raster_width, int raster_height, int s_x, int s_y, void *raster_buffer) |
| 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_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 *ds_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) |
| 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) |
| EPR_SPtrArray * | epr_create_flag_coding (EPR_SProductId *product_id, const char *str) |
| EPR_SFlagDef * | epr_create_flag_def () |
| void | epr_free_flag_def (EPR_SFlagDef *flag_def) |
| void | epr_free_flag_coding (EPR_SPtrArray *flag_coding) |
Macro Definition Documentation
◆ FLAG_MASK_NOT_COMPUTED
| #define FLAG_MASK_NOT_COMPUTED ((epr_uint) -1) |
Definition at line 26 of file epr_bitmask.h.
Typedef Documentation
◆ EPR_EBmOpCode
| typedef enum EPR_BmOpCode EPR_EBmOpCode |
Definition at line 31 of file epr_bitmask.h.
Enumeration Type Documentation
◆ EPR_BmOpCode
| enum EPR_BmOpCode |
| Enumerator | |
|---|---|
| BMT_UNKNOWN | |
| BMT_REF | |
| BMT_AND | |
| BMT_OR | |
| BMT_NOT | |
Definition at line 36 of file epr_bitmask.h.
◆ EPR_Tok
| enum EPR_Tok |
| Enumerator | |
|---|---|
| BME_UNKNOWN | |
| BME_EOS | |
| BME_SPECIAL | |
| BME_NAME | |
Definition at line 44 of file epr_bitmask.h.
Function Documentation
◆ epr_consume_token()
| char* epr_consume_token | ( | EPR_SParseInfo * | parse_info | ) |
Releases the actual token given expression.
- Parameters
-
parse_info parse_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_id the product ID offset_x X-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search offset_y Y-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search raster the 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
-
term the 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
-
str the 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
-
term the bitmask term x the x co-ordinate in pixels y the y co-ordinate in pixels
Evaluates the given bitmask expression.
- Parameters
-
term the bitmask term x the pixel's x co-ordinate y the 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
-
context the bit mask context, if NULLthe 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_info parse_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_info parse_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_info parse_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_info parse_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_info parse_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_info parse_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_info parse_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_info parse_info structure term_required the 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 a bitmask expression string.
The bit-mask expressions recognized by this parser must have the following syntax:
bit-mask-expression :=
or-expressionor-expression :=
and-expression
or-expressionorand-expressionand-expression :=
not-expression
and-expressionandnot-expressionnot-expression :=
primary-expression
notnot-expressionprimary-expression :=
flag-reference
(bit-mask-expression)flag-reference :=
dataset-name.flag-name
Where dataset-name and flag-name are names specific for a particular data product. Names are in general resolved case-insenitively. The parser also accepts an alternate notation for the boolean operators:
The
|character for theoroperator,
the&character for theandoperator and finally
the!character for thenotoperator.
For example, the following parseBitmaskExpression request will perform without errors:
BitmaskTerm term = BitmaskExpressionParser.parse("flags.LAND and not flags.DDV");
Another example for a valid expression in alternatate notation is:
BitmaskTerm term = BitmaskExpressionParser.parse("flags.LAND | (flags.COASTLINE & !flags.CLOUD)");
The terms created in the examples above could successfully be evaluated in an evaluation context provided by an ENVISAT MERIS Level 2 data product.
- Parameters
-
bm_expr the bitmask expression
- Returns
- the bitmask term representing the given expression
Parses the bit-mask expression given as character string.
- Parameters
-
bm_expr the bit-mask expression given as character string
- Returns
- the bit-mask term tree representing the bit-mask expression
- Exceptions
-
BitmaskExpressionParseException if the given code could not be epr_parse'd IOException if 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_read_bitmask_data()
| int epr_read_bitmask_data | ( | const EPR_SProductId * | product_id, |
| const char * | bm_expr, | ||
| int | xo, | ||
| int | yo, | ||
| int | raster_width, | ||
| int | raster_height, | ||
| int | s_x, | ||
| int | s_y, | ||
| void * | raster_buffer | ||
| ) |
Reads bit-mask pixels of the given product for the given bit-mask expression for the given region and and with the given sub-sampling.
bit-mask-expression :=
or-expressionor-expression :=
and-expression
or-expressionorand-expressionand-expression :=
not-expression
and-expressionandnot-expressionnot-expression :=
primary-expression
notnot-expressionprimary-expression :=
flag-reference
(bit-mask-expression)flag-reference :=
dataset-name.flag-name
Where dataset-name and flag-name are names specific for a particular data product. Names are in general resolved case-insenitively. The parser also accepts an alternate notation for the boolean operators:
The
|character for theoroperator,
the&character for theandoperator and finally
the!character for thenotoperator.
- Parameters
-
product_id the product ID bm_expr the bit-mask expression xo X-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search yo Y-coordinate in pixel co-ordinates (zero-based) of the upper right corner raster to search raster_width the width in pixel co-ordinates of the raster to search raster_height the height in pixel co-ordinates of raster to search s_x X-step in pixel co-ordinates to get the next raster to search s_y Y-step in pixel co-ordinates to get the next raster to search raster_buffer [BYTE] the memory buffer to save information was read
- Returns
- zero for success, and error code otherwise
◆ 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.


