| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
# 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
Method Summary | |
int | DDT_ACCESS_clean(in table) Removes access for the given name and frees the internal buffers. |
int | DDT_ACCESS_get_next(in table) Returns the name of the next test to be processed. |
int | DDT_ACCESS_has_more(in table) Indicates whether a subsequent call to DDT_ACCESS_get_next() is about to succeed or not. |
int | DDT_ACCESS_init(in table, in tests) Initialises the standard access algorithm. |
Method Detail |
public int DDT_ACCESS_clean(in table)
name and frees the internal buffers.- Parameters:
- table - (in) the name od the iterator (data table)
public int DDT_ACCESS_get_next(in table)
public int DDT_ACCESS_has_more(in table)
public int 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).
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |