|
ocssw
1.0
|
Go to the source code of this file.
Classes | |
| struct | EPR_SBmTerm |
| struct | EPR_SBmEvalContext |
| struct | EPR_SBmFlagDataset |
| struct | EPR_SParseInfo |
Defines | |
| #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_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) |
| 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) |
| #define FLAG_MASK_NOT_COMPUTED ((epr_uint) -1) |
Definition at line 27 of file epr_bitmask.h.
| typedef enum EPR_BmOpCode EPR_EBmOpCode |
Definition at line 32 of file epr_bitmask.h.
| enum EPR_BmOpCode |
Definition at line 38 of file epr_bitmask.h.
| enum EPR_Tok |
Definition at line 47 of file epr_bitmask.h.
| char* epr_consume_token | ( | EPR_SParseInfo * | parse_info | ) |
Releases the actual token given expression.
| parse_info | parse_info structure |
Definition at line 587 of file epr_bitmask.c.
| 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_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
| 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 |
Definition at line 39 of file epr_bitmask.c.
| 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.
| term | the term to be converted |
Definition at line 880 of file epr_bitmask.c.
| 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_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_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_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_SPtrArray* epr_create_flag_coding | ( | EPR_SProductId * | product_id, |
| const char * | str | ||
| ) |
Creates the coding flag info
| str | the local path to dddb |
Definition at line 333 of file epr_bitmask.c.
| EPR_SFlagDef* epr_create_flag_def | ( | ) |
Creates the coding flag definition
Definition at line 414 of file epr_bitmask.c.
| epr_boolean epr_eval_bm_term | ( | EPR_SBmEvalContext * | context, |
| EPR_SBmTerm * | term, | ||
| int | x, | ||
| int | y | ||
| ) |
Evaluates the given bitmask expression.
| term | the bitmask term |
| x | the x co-ordinate in pixels |
| y | the y co-ordinate in pixels |
Evaluates the given bitmask expression.
| 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.
| void epr_free_bm_eval_context | ( | EPR_SBmEvalContext * | context | ) |
Release the memory allocated through a EPR_SBmEvalContext.
| context | the bit mask context, if NULL the function immediately returns zero. |
Definition at line 62 of file epr_bitmask.c.
| void epr_free_bm_term | ( | EPR_SBmTerm * | term | ) |
Releases a new bitmask term instance.
Definition at line 844 of file epr_bitmask.c.
| void epr_free_flag_coding | ( | EPR_SPtrArray * | flag_coding | ) |
Releases the coding flag info
Definition at line 395 of file epr_bitmask.c.
| void epr_free_flag_def | ( | EPR_SFlagDef * | flag_def | ) |
Releases the coding flag definition
Definition at line 430 of file epr_bitmask.c.
| int epr_get_token_char | ( | EPR_SParseInfo * | parse_info | ) |
Gets the first character of token for the given expression or EOS.
| parse_info | parse_info structure |
Definition at line 580 of file epr_bitmask.c.
| epr_boolean epr_is_bm_AND_keyword | ( | EPR_SParseInfo * | parse_info | ) |
Definition at line 548 of file epr_bitmask.c.
| epr_boolean epr_is_bm_AND_operator | ( | EPR_SParseInfo * | parse_info | ) |
This group of functions is for recognizing the operator.
| parse_info | parse_info structure |
Definition at line 556 of file epr_bitmask.c.
| epr_boolean epr_is_bm_EOS_token | ( | EPR_SParseInfo * | parse_info | ) |
Tests the given expression for the end of string.
| parse_info | parse_info structure |
Definition at line 572 of file epr_bitmask.c.
| epr_boolean epr_is_bm_expr_error | ( | EPR_SParseInfo * | parse_info | ) |
Tests the given expression for errors.
| parse_info | parse_info structure |
Definition at line 576 of file epr_bitmask.c.
| epr_boolean epr_is_bm_name_token | ( | EPR_SParseInfo * | parse_info | ) |
Tests the given expression for operand name only (not operator).
| parse_info | parse_info structure |
Definition at line 568 of file epr_bitmask.c.
| epr_boolean epr_is_bm_NOT_keyword | ( | EPR_SParseInfo * | parse_info | ) |
Definition at line 552 of file epr_bitmask.c.
| epr_boolean epr_is_bm_NOT_operator | ( | EPR_SParseInfo * | parse_info | ) |
Definition at line 564 of file epr_bitmask.c.
| epr_boolean epr_is_bm_OR_keyword | ( | EPR_SParseInfo * | parse_info | ) |
This group of functions is for recognizing the keyword.
| parse_info | parse_info structure |
Definition at line 544 of file epr_bitmask.c.
| epr_boolean epr_is_bm_OR_operator | ( | EPR_SParseInfo * | parse_info | ) |
Definition at line 560 of file epr_bitmask.c.
| void epr_next_bm_expr_token | ( | EPR_SParseInfo * | parse_info | ) |
Selectss the next token given expression.
| parse_info | parse_info structure |
Definition at line 597 of file epr_bitmask.c.
| 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_SBmTerm* epr_parse_bm_expr | ( | EPR_SParseInfo * | parse_info, |
| epr_boolean | term_required | ||
| ) |
This group of functions is for parsing the expression.
| parse_info | parse_info structure |
| term_required | the boolean value expression. |
Definition at line 445 of file epr_bitmask.c.
| 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:
<blockquote>
bit-mask-expression :=
or-expression
or-expression :=
and-expression
or-expression or and-expression
and-expression :=
not-expression
and-expression and not-expression
not-expression :=
primary-expression
not not-expression
primary-expression :=
flag-reference
( bit-mask-expression )
flag-reference :=
dataset-name.flag-name </blockquote>
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: <blockquote> The | character for the or operator,
the & character for the and operator and finally
the ! character for the not operator. </blockquote>
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.
| bm_expr | the bitmask expression |
Parses the bit-mask expression given as character string.
| bm_expr | the bit-mask expression given as character string |
| 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_SBmTerm* epr_parse_bm_OR_expr | ( | EPR_SParseInfo * | parse_info, |
| epr_boolean | term_required | ||
| ) |
Definition at line 451 of file epr_bitmask.c.
| 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_SBmTerm* epr_parse_bm_unary_expr | ( | EPR_SParseInfo * | parse_info, |
| epr_boolean | term_required | ||
| ) |
Definition at line 492 of file epr_bitmask.c.
| 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.
| void epr_push_back_bm_expr_token | ( | EPR_SParseInfo * | parse_info | ) |
Definition at line 608 of file epr_bitmask.c.
| 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.
<blockquote>
bit-mask-expression :=
or-expression
or-expression :=
and-expression
or-expression or and-expression
and-expression :=
not-expression
and-expression and not-expression
not-expression :=
primary-expression
not not-expression
primary-expression :=
flag-reference
( bit-mask-expression )
flag-reference :=
dataset-name.flag-name </blockquote>
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: <blockquote> The | character for the or operator,
the & character for the and operator and finally
the ! character for the not operator. </blockquote>
| 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 |
| void epr_set_bm_expr_error | ( | EPR_SParseInfo * | parse_info, |
| const char * | message | ||
| ) |
Definition at line 612 of file epr_bitmask.c.
| int epr_tokenize_bm_expr | ( | const char * | bm_expr, |
| int * | bm_expr_pos, | ||
| char ** | token | ||
| ) |
Definition at line 635 of file epr_bitmask.c.
| 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.
1.7.6.1