1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>CODA Expression</title>
<link href="../css/codadoc.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div class="wide">
<center>
<a class="qindex" href="index.html">Main Page</a>
<a class="qindex" href="modules.html">Modules</a>
</center>
<hr>
<!-- Generated by Doxygen 1.9.3 -->
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">CODA Expression</div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gacb6d1fb7aced08411202c453058f13de"><td class="memItemLeft" align="right" valign="top">typedef struct coda_expression_struct </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a></td></tr>
<tr class="separator:gacb6d1fb7aced08411202c453058f13de"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga88138321ee790725aa247b7a92322937"><td class="memItemLeft" align="right" valign="top">typedef enum coda_expression_type_enum </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga88138321ee790725aa247b7a92322937">coda_expression_type</a></td></tr>
<tr class="separator:ga88138321ee790725aa247b7a92322937"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga1a159276570a91f937ad2a39d3517896"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga1a159276570a91f937ad2a39d3517896">coda_expression_print</a> (const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr, int(*print)(const char *,...))</td></tr>
<tr class="separator:ga1a159276570a91f937ad2a39d3517896"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1e4db98f5a19241a855455616c113702"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga1e4db98f5a19241a855455616c113702">coda_expression_get_type_name</a> (<a class="el" href="group__coda__expression.html#ga88138321ee790725aa247b7a92322937">coda_expression_type</a> type)</td></tr>
<tr class="separator:ga1e4db98f5a19241a855455616c113702"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad20307607cba2cc858a6b712584a0fe3"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#gad20307607cba2cc858a6b712584a0fe3">coda_expression_delete</a> (<a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr)</td></tr>
<tr class="separator:gad20307607cba2cc858a6b712584a0fe3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaffb1c92d0f074c7d34eb473f62a9cfc6"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#gaffb1c92d0f074c7d34eb473f62a9cfc6">coda_expression_is_constant</a> (const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr)</td></tr>
<tr class="separator:gaffb1c92d0f074c7d34eb473f62a9cfc6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga704de4c7f2db14b08a4271acbc879a70"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga704de4c7f2db14b08a4271acbc879a70">coda_expression_is_equal</a> (const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr1, const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr2)</td></tr>
<tr class="separator:ga704de4c7f2db14b08a4271acbc879a70"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1a7e08b1be64c25f2f17ad65c8770b45"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga1a7e08b1be64c25f2f17ad65c8770b45">coda_expression_get_type</a> (const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr, <a class="el" href="group__coda__expression.html#ga88138321ee790725aa247b7a92322937">coda_expression_type</a> *type)</td></tr>
<tr class="separator:ga1a7e08b1be64c25f2f17ad65c8770b45"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga59d14144af09d8b750e2babcd0f62c79"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga59d14144af09d8b750e2babcd0f62c79">coda_expression_eval_bool</a> (const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr, const <a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> *cursor, int *value)</td></tr>
<tr class="separator:ga59d14144af09d8b750e2babcd0f62c79"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1aa0dfd6761665899f988696781b4b1d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga1aa0dfd6761665899f988696781b4b1d">coda_expression_eval_integer</a> (const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr, const <a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> *cursor, int64_t *value)</td></tr>
<tr class="separator:ga1aa0dfd6761665899f988696781b4b1d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga245a804d69d638e0b999dc0730509c35"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga245a804d69d638e0b999dc0730509c35">coda_expression_eval_float</a> (const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr, const <a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> *cursor, double *value)</td></tr>
<tr class="separator:ga245a804d69d638e0b999dc0730509c35"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga55319b1ccc2afae12eb6512e950cf079"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga55319b1ccc2afae12eb6512e950cf079">coda_expression_eval_string</a> (const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr, const <a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> *cursor, char **value, long *length)</td></tr>
<tr class="separator:ga55319b1ccc2afae12eb6512e950cf079"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga671c286f9a957262fcd827c7222679b0"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga671c286f9a957262fcd827c7222679b0">coda_expression_eval_node</a> (const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr, <a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> *cursor)</td></tr>
<tr class="separator:ga671c286f9a957262fcd827c7222679b0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga8b885895be1935c58296fbe27bb72928"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__coda__expression.html#ga8b885895be1935c58296fbe27bb72928">coda_expression_from_string</a> (const char *exprstring, <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> **expr)</td></tr>
<tr class="separator:ga8b885895be1935c58296fbe27bb72928"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p >CODA comes with a powerful expression language that can be used to perform calculations based on product data. This expression system is used internally with the product format definition (codadef) files that CODA uses to interpret products, but it can also be used by you as a user for your own purposes. More information on the CODA expression language and its ascii syntax can be found in the CODA documentation.</p>
<p >The example below shows how to evaluate a simple integer expression that does not make use of any product data: </p><div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> *equation = <span class="stringliteral">"1+2"</span>;</div>
<div class="line"><a class="code hl_typedef" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr;</div>
<div class="line"><span class="keywordtype">long</span> result;</div>
<div class="line"> </div>
<div class="line"><a class="code hl_function" href="group__coda__expression.html#ga8b885895be1935c58296fbe27bb72928">coda_expression_from_string</a>(equation, &expr);</div>
<div class="line"><a class="code hl_function" href="group__coda__expression.html#ga1aa0dfd6761665899f988696781b4b1d">coda_expression_eval_integer</a>(expr, NULL, &result);</div>
<div class="line"><a class="code hl_function" href="group__coda__expression.html#gad20307607cba2cc858a6b712584a0fe3">coda_expression_delete</a>(expr);</div>
<div class="line">printf(<span class="stringliteral">"%d\n"</span>, result);</div>
<div class="ttc" id="agroup__coda__expression_html_ga1aa0dfd6761665899f988696781b4b1d"><div class="ttname"><a href="group__coda__expression.html#ga1aa0dfd6761665899f988696781b4b1d">coda_expression_eval_integer</a></div><div class="ttdeci">int coda_expression_eval_integer(const coda_expression *expr, const coda_cursor *cursor, int64_t *value)</div><div class="ttdef"><b>Definition:</b> coda-expr.c:5169</div></div>
<div class="ttc" id="agroup__coda__expression_html_ga8b885895be1935c58296fbe27bb72928"><div class="ttname"><a href="group__coda__expression.html#ga8b885895be1935c58296fbe27bb72928">coda_expression_from_string</a></div><div class="ttdeci">int coda_expression_from_string(const char *exprstring, coda_expression **expr)</div><div class="ttdef"><b>Definition:</b> coda-expr-parser.c:5022</div></div>
<div class="ttc" id="agroup__coda__expression_html_gacb6d1fb7aced08411202c453058f13de"><div class="ttname"><a href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a></div><div class="ttdeci">struct coda_expression_struct coda_expression</div><div class="ttdef"><b>Definition:</b> coda.h:331</div></div>
<div class="ttc" id="agroup__coda__expression_html_gad20307607cba2cc858a6b712584a0fe3"><div class="ttname"><a href="group__coda__expression.html#gad20307607cba2cc858a6b712584a0fe3">coda_expression_delete</a></div><div class="ttdeci">void coda_expression_delete(coda_expression *expr)</div><div class="ttdef"><b>Definition:</b> coda-expr.c:4958</div></div>
</div><!-- fragment --><p >However, in most cases you will want to run an expression on actual product data. In the example below the expression expects a cursor that points to a record which has two fields, 'numerator' and 'denominator', and it will return a floating point value with the division of those two field values. </p><div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> *equation = <span class="stringliteral">"float(./numerator)/float(./denominator)"</span>;</div>
<div class="line"><a class="code hl_typedef" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> cursor;</div>
<div class="line"><a class="code hl_typedef" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> *expr;</div>
<div class="line"><span class="keywordtype">double</span> result;</div>
<div class="line"> </div>
<div class="line"><a class="code hl_function" href="group__coda__expression.html#ga8b885895be1935c58296fbe27bb72928">coda_expression_from_string</a>(equation, &expr);</div>
<div class="line"> </div>
<div class="line">... loop over all cursors <span class="keywordflow">for</span> which you want to calculate the division ....</div>
<div class="line"><a class="code hl_function" href="group__coda__expression.html#ga1aa0dfd6761665899f988696781b4b1d">coda_expression_eval_integer</a>(expr, &cursor, &result);</div>
<div class="line">printf(<span class="stringliteral">"%f\n"</span>, result);</div>
<div class="line">... end of loop ...</div>
<div class="line"> </div>
<div class="line">coda_expression_delete(expr);</div>
<div class="ttc" id="agroup__coda__cursor_html_ga86506368d642120e9491eee25e45c2de"><div class="ttname"><a href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a></div><div class="ttdeci">struct coda_cursor_struct coda_cursor</div><div class="ttdef"><b>Definition:</b> coda.h:326</div></div>
</div><!-- fragment --><p >Note that, unlike most other CODA functions, the <a class="el" href="group__coda__expression.html#ga8b885895be1935c58296fbe27bb72928">coda_expression_from_string()</a> and <a class="el" href="group__coda__expression.html#gad20307607cba2cc858a6b712584a0fe3">coda_expression_delete()</a> functions do not require that CODA is initialised with <a class="el" href="group__coda__general.html#ga8e7601eb0f115a4052e4af96668b3429">coda_init()</a>. This also holds for the coda_expression_eval functions if no cursor is provided as parameter (i.e. when a static evaluation of the expression is performed). </p>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="gacb6d1fb7aced08411202c453058f13de" name="gacb6d1fb7aced08411202c453058f13de"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacb6d1fb7aced08411202c453058f13de">◆ </a></span>coda_expression</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a></td>
</tr>
</table>
</div><div class="memdoc">
<p >CODA Expression </p>
</div>
</div>
<a id="ga88138321ee790725aa247b7a92322937" name="ga88138321ee790725aa247b7a92322937"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga88138321ee790725aa247b7a92322937">◆ </a></span>coda_expression_type</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__coda__expression.html#ga88138321ee790725aa247b7a92322937">coda_expression_type</a></td>
</tr>
</table>
</div><div class="memdoc">
<p >Result types of CODA expressions. </p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="gad20307607cba2cc858a6b712584a0fe3" name="gad20307607cba2cc858a6b712584a0fe3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad20307607cba2cc858a6b712584a0fe3">◆ </a></span>coda_expression_delete()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void coda_expression_delete </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Delete the CODA expression object. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr</td><td>A CODA expression object </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga59d14144af09d8b750e2babcd0f62c79" name="ga59d14144af09d8b750e2babcd0f62c79"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga59d14144af09d8b750e2babcd0f62c79">◆ </a></span>coda_expression_eval_bool()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_eval_bool </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>value</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Evaluate a boolean expression. The expression object should be a coda_expression_bool expression. The function will evaluate the expression at the given cursor position and return the resulting boolean value (which will be 0 for False and 1 for True). </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr</td><td>A boolean expression object </td></tr>
<tr><td class="paramname">cursor</td><td>Cursor pointing to a location in the product where the boolean expression should be evaluated (can be NULL for constant expressions). </td></tr>
<tr><td class="paramname">value</td><td>Pointer to the variable where the resulting boolean value will be stored. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, Success. </li>
<li><code>-1</code>, Error occurred (check <a class="el" href="group__coda__error.html#gafcb445c7fcab2d4d0af01f0e1c2dc866">coda_errno</a>). </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ga245a804d69d638e0b999dc0730509c35" name="ga245a804d69d638e0b999dc0730509c35"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga245a804d69d638e0b999dc0730509c35">◆ </a></span>coda_expression_eval_float()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_eval_float </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double * </td>
<td class="paramname"><em>value</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Evaluate a floating point expression. The function will evaluate the expression at the given cursor position and return the resulting floating point value. The expression object should be a coda_expression_float expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr</td><td>A floating point expression object </td></tr>
<tr><td class="paramname">cursor</td><td>Cursor pointing to a location in the product where the floating point expression should be evaluated (can be NULL for constant expressions). </td></tr>
<tr><td class="paramname">value</td><td>Pointer to the variable where the resulting floating point value will be stored. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, Success. </li>
<li><code>-1</code>, Error occurred (check <a class="el" href="group__coda__error.html#gafcb445c7fcab2d4d0af01f0e1c2dc866">coda_errno</a>). </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ga1aa0dfd6761665899f988696781b4b1d" name="ga1aa0dfd6761665899f988696781b4b1d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1aa0dfd6761665899f988696781b4b1d">◆ </a></span>coda_expression_eval_integer()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_eval_integer </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int64_t * </td>
<td class="paramname"><em>value</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Evaluate an integer expression. The expression object should be a coda_expression_integer expression. The function will evaluate the expression at the given cursor position and return the resulting integer value. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr</td><td>An integer expression object </td></tr>
<tr><td class="paramname">cursor</td><td>Cursor pointing to a location in the product where the integer expression should be evaluated (can be NULL for constant expressions). </td></tr>
<tr><td class="paramname">value</td><td>Pointer to the variable where the resulting integer value will be stored. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, Success. </li>
<li><code>-1</code>, Error occurred (check <a class="el" href="group__coda__error.html#gafcb445c7fcab2d4d0af01f0e1c2dc866">coda_errno</a>). </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ga671c286f9a957262fcd827c7222679b0" name="ga671c286f9a957262fcd827c7222679b0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga671c286f9a957262fcd827c7222679b0">◆ </a></span>coda_expression_eval_node()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_eval_node </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> * </td>
<td class="paramname"><em>cursor</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Evaluate a node expression. The function will moves the cursor to a different position in a product based on the node expression. The expression object should be a coda_expression_node expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr</td><td>A node expression object </td></tr>
<tr><td class="paramname">cursor</td><td>Cursor pointing to a location in the product where the node expression should be evaluated. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, Success. </li>
<li><code>-1</code>, Error occurred (check <a class="el" href="group__coda__error.html#gafcb445c7fcab2d4d0af01f0e1c2dc866">coda_errno</a>). </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ga55319b1ccc2afae12eb6512e950cf079" name="ga55319b1ccc2afae12eb6512e950cf079"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga55319b1ccc2afae12eb6512e950cf079">◆ </a></span>coda_expression_eval_string()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_eval_string </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="group__coda__cursor.html#ga86506368d642120e9491eee25e45c2de">coda_cursor</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char ** </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long * </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Evaluate a string expression. The function will evaluate the expression at the given cursor position (if provided) and return the resulting string and length. If length is 0 then no string will be returned and <code>value</code> will be set to NULL. If a string is returned then it will be zero terminated. However, in the case where the string itself also contains zero characters, strlen() can not be used and the <code>length</code> parameter will give the actual string length of <code>value</code>. The expression object should be a coda_expression_string expression. </p><dl class="section note"><dt>Note</dt><dd>The caller of this function is responsible for freeing the memory of the result that is stored in <code>value</code>. It is recommended to do this with <a class="el" href="group__coda__general.html#gacbf60303b9f9e5b9ffea8a31cfa08072">coda_free()</a>. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr</td><td>A string expression object </td></tr>
<tr><td class="paramname">cursor</td><td>Cursor pointing to a location in the product where the string expression should be evaluated (can be NULL for constant expressions). </td></tr>
<tr><td class="paramname">value</td><td>Pointer to the variable where the result string will be stored (will be NULL if length == 0). </td></tr>
<tr><td class="paramname">length</td><td>Pointer to the variable where the length of the result string will be stored. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, Success. </li>
<li><code>-1</code>, Error occurred (check <a class="el" href="group__coda__error.html#gafcb445c7fcab2d4d0af01f0e1c2dc866">coda_errno</a>). </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ga8b885895be1935c58296fbe27bb72928" name="ga8b885895be1935c58296fbe27bb72928"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8b885895be1935c58296fbe27bb72928">◆ </a></span>coda_expression_from_string()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_from_string </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>exprstring</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> ** </td>
<td class="paramname"><em>expr</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Create a new CODA expression object by parsing a string containing a CODA expression. The string should contain a valid CODA expression. The returned expression object should be cleaned up using <a class="el" href="group__coda__expression.html#gad20307607cba2cc858a6b712584a0fe3">coda_expression_delete()</a> after it has been used. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">exprstring</td><td>A string containing the string representation of the CODA expression </td></tr>
<tr><td class="paramname">expr</td><td>Pointer to the variable where the expression object will be stored. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, Success. </li>
<li><code>-1</code>, Error occurred (check <a class="el" href="group__coda__error.html#gafcb445c7fcab2d4d0af01f0e1c2dc866">coda_errno</a>). </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ga1a7e08b1be64c25f2f17ad65c8770b45" name="ga1a7e08b1be64c25f2f17ad65c8770b45"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1a7e08b1be64c25f2f17ad65c8770b45">◆ </a></span>coda_expression_get_type()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_get_type </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__coda__expression.html#ga88138321ee790725aa247b7a92322937">coda_expression_type</a> * </td>
<td class="paramname"><em>type</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Retrieve the result type of a CODA expression. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr</td><td>A CODA expression object </td></tr>
<tr><td class="paramname">type</td><td>Pointer to the variable where the result type of the CODA expression will be stored. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, Success. </li>
<li><code>-1</code>, Error occurred (check <a class="el" href="group__coda__error.html#gafcb445c7fcab2d4d0af01f0e1c2dc866">coda_errno</a>). </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ga1e4db98f5a19241a855455616c113702" name="ga1e4db98f5a19241a855455616c113702"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1e4db98f5a19241a855455616c113702">◆ </a></span>coda_expression_get_type_name()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char * coda_expression_get_type_name </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__coda__expression.html#ga88138321ee790725aa247b7a92322937">coda_expression_type</a> </td>
<td class="paramname"><em>type</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Returns the name of an expression type. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>CODA expression type </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>if the type is known a string containing the name of the type, otherwise the string "unknown". </dd></dl>
</div>
</div>
<a id="gaffb1c92d0f074c7d34eb473f62a9cfc6" name="gaffb1c92d0f074c7d34eb473f62a9cfc6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaffb1c92d0f074c7d34eb473f62a9cfc6">◆ </a></span>coda_expression_is_constant()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_is_constant </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Return whether an expression is constant or not. An expression is constant if it does not depend on the contents of a product and if the expression evaluation function can be called with cursor=NULL. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr</td><td>A CODA expression object </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, Expression will depend on the contents of a product. </li>
<li><code>1</code>, Expression is constant. </li>
<li><code>-1</code>, Error occurred (check <a class="el" href="group__coda__error.html#gafcb445c7fcab2d4d0af01f0e1c2dc866">coda_errno</a>). </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ga704de4c7f2db14b08a4271acbc879a70" name="ga704de4c7f2db14b08a4271acbc879a70"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga704de4c7f2db14b08a4271acbc879a70">◆ </a></span>coda_expression_is_equal()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_is_equal </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr2</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Determines whether two expressions are equal or not This function will return 1 if both expressions are equal, and 0 if they are not.</p>
<p >The comparison will not be on the evaluated result of the expressions but on the operators and operands of the expressions themselves. For two expressions to be equal, all operands to an operation need to be equal and operands need to be provided in the same order. So the expression '1!=2' will not be considered equal to the expression '2!=1'.</p>
<p >Providing two NULL pointers will be considered as a case of equal expressions.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr1</td><td>A CODA expression object </td></tr>
<tr><td class="paramname">expr2</td><td>A CODA expression object </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, expr1 and expr2 consist of the exact same sequence of operators and operands. </li>
<li><code>1</code>, expr1 and expr2 differ in terms of operators and operands. </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ga1a159276570a91f937ad2a39d3517896" name="ga1a159276570a91f937ad2a39d3517896"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1a159276570a91f937ad2a39d3517896">◆ </a></span>coda_expression_print()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int coda_expression_print </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="group__coda__expression.html#gacb6d1fb7aced08411202c453058f13de">coda_expression</a> * </td>
<td class="paramname"><em>expr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int(*)(const char *,...) </td>
<td class="paramname"><em>print</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p >Write the full expression using a printf compatible function. This function will produce a string representation of the expression itself (it won't evaluate the expression, nor write its result). The <em>print</em> function parameter should be a function that resembles printf(). The printed string representation is something that can be passed to <a class="el" href="group__coda__expression.html#ga8b885895be1935c58296fbe27bb72928">coda_expression_from_string()</a> again to reproduce the expression object. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">expr</td><td>Pointer to the expression object. </td></tr>
<tr><td class="paramname">print</td><td>Reference to a printf compatible function. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li><code>0</code>, Succes. </li>
<li><code>-1</code>, Error occurred (check <a class="el" href="group__coda__error.html#gafcb445c7fcab2d4d0af01f0e1c2dc866">coda_errno</a>). </li>
</ul>
</dd></dl>
</div>
</div>
</div><!-- contents -->
<div class="footer">
<hr><p>Copyright © 2007-2022 <b>s<span class="soft-red">[</span>&<span class="soft-red">]</span>t</b>, The Netherlands.
</p>
</div>
</div>
</body>
</html>
|