IBM
Contents Index Previous Next



Example of TTCN Access Functionality


As TTCN Access looks upon a test suite as a parse tree, it provides the required primitives and functionality for parse tree handling. This includes parse tree traversing and hooks into the parse tree as well as templates for main() and several examples in source code format. The best way to visualize the functionality of TTCN Access is by using an example:

Figure 177 : The PCO Declarations table

The PCO Declarations table, containing just one PCO declaration will generate the parse tree visualized below:

Figure 178 : Parse tree

Traversing

The basics of parse tree functionality has to include traversing primitives. TTCN Access therefore provides a special visitor class with a default traverser that, given any node in the parse tree, traverses that parse tree in a Left-Right-Depth-First manner. In the parse tree previously described, the default traversing order for the sub tree PCO_Dcl will be:

Figure 179 : Default traversing tree

This default translating algorithm may be customized in order to fit any user specific traversing order. For the above example, a customized traverser could be implemented as traversing sub tree PCO_TypeId before sub tree PCO_Id and ignoring sub tree Comment.

Translating

The second most important functionality when discussing parse trees, is the possibility to access specific nodes in the parse tree in order to generate side effects, such as executing external code, print parse tree information, etc. By being able to modify the default traverser, TTCN Access provides the user with the possibility of defining such side effects.


http://www.ibm.com/rational
Contents Index Previous Next