|
FRM v1.4.2 |
||||||||
PREV SCRIPT NEXT SCRIPT | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | FUNCT | DETAIL: FIELD | CONSTR | FUNCT |
CompiledModule | +--emos_ddt_access_lib
This library defines a sequential forward "iterator" (as much as one can emulate a real iterator in a language such as TSL) for data tables (ddt-interface). The main benefits of this iterator are: 1.) you can loop through any table in an uniform way, 2.) you can elegantly define a set of entries to be iterated through, 3.) you can simultaneously have iterators for multiple data tables (ane at a time per table!) 4.) you can use it to iterate anything, not only data tables.
NOTE! To understand how this iterator works use the analogy of selecting pages to be printed in a word-processing program. This sort of dialogs typically allow you to specify the RANGE of pages by connecting a first and the last page in the range with a hyphen (e.g. 3-9 ) and INDIVIDUAL pages by separating them with commas (e.g. 1,5,9,15-17,20). Exactly the same syntax is used with this iterator. So, if you call
DDT_ACCESS_init( table, "1-3,7,9-11" );the
DDT_ACCESS_get_next( table );will return you the sequence 1,2,3,7,9,10,11. This iterator also accepts non-numeric expressions such as
DDT_ACCESS_init( table, "foo,bar,anyway" );Note however that this iterator does not read a data table in any way. So if your table contains following five columns
aaa;foo;ccc;bar;eeethe expression
DDT_ACCESS_init( table, "foo-bar" );will return you "foo-bar" instead of "foo", "ccc", "bar" as you might have expected. If you use alpha names you, should know them in advance, i.e.
DDT_ACCESS_init( table, "foo,ccc,bar" );You might think of this as a serious limitation, but once you learn how EMOS uses data tables in its framework, you will probably apreciate the
Function Summary | |
protected String |
col_test_invalid()
Test with invalid values |
protected String |
col_test_valid()
Test with valid values |
String |
DDT_ACCESS_clean(in table)
Removes access for the given name and frees the internal buffers. |
String |
DDT_ACCESS_get_next(in table)
Returns the name of the next test to be processed. |
String |
DDT_ACCESS_has_more(in table)
Indicates whether a subsequent call to DDT_ACCESS_get_next() is about to succeed or not. |
String |
DDT_ACCESS_init(in table,
in tests)
Initialises the standard access algorithm. |
protected String |
delete_dimension(inout[] arr,
in dim)
This function deletes a dimension from a multidimensional array. |
protected String |
get_range(in from,
in to,
out x,
out y,
out b)
|
protected String |
init_count(in table,
in tests)
Analyses the given string tests and builds an array that contains all
individual values that were specified. |
Function Detail |
public String DDT_ACCESS_init(in table, in tests)
tests
can be specified
with syntax described on library-level (e.g. "1-5,7,9,aaa,xxx,12-35).
table
- (in) unique name for the iterator (normaly, name of the data table)tests
- (in) test names (e.g. "1-15" or "1-3,5,7" or "a,b,c", etc.)
public String DDT_ACCESS_clean(in table)
name and frees the internal buffers.
- Parameters:
table
- (in) the name od the iterator (data table)
public String DDT_ACCESS_has_more(in table)
table
- (in) the name od the iterator (data table)
public String DDT_ACCESS_get_next(in table)
table
- (in) the name od the iterator (data table)
protected String init_count(in table, in tests)
tests
and builds an array that contains all
individual values that were specified.
table
- (in) table dimensiontests
- (in) test names in format (1,3-9)
protected String get_range(in from, in to, out x, out y, out b)
protected String delete_dimension(inout[] arr, in dim)
WARNING!
It will delete ALL dimensions with the same name. For example assume your three-dimensional array "arr" has the following content:
arr["x",1,"x"] = "x1x"; arr["x",1,"y"] = "x1y"; arr["y",1,"x"] = "y1x"; arr["y",1,"y"] = "y1Y";then the following command
delete_dimension( arr, "x" );will delete everything BUT
arr["y",1,"y"] = "y1Y";
arr
- (inout) array to be processeddim
- (in) dimension(s) to be removedprotected String col_test_valid()
protected String col_test_invalid()
|
FRM v1.4.2 |
||||||||
PREV SCRIPT NEXT SCRIPT | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | FUNCT | DETAIL: FIELD | CONSTR | FUNCT |