I read that when ttcn function is annotated with "runs on SomeComponent", it means that when it is called, it gets passed an instance of that SomeComponent. How can this function access this instance? Is it available in some special variable?
when a ttcn function "runs on SomeComponent", how can it access the instance of this SomeCOmponent type?
77 views Asked by Herosław Miraszewski At
2
There are 2 answers
0
On
As Nomce said, the instance variables of a component are available in the same scope as local variables (mixing dynamic and static scoping).
But sometimes you need the actual component reference - in case you need to pass it around, do mappings or connection (store in array and - generally - perform dynamic configuration). Then you can use the special self reference.
Inside the function, you can use all variables defined in SomeComponent as if they are local variables defined in the function.
The only difference between these variables and local variables is that their lifetime and scope is larger than local's. Their values are accessible in all functions that run on that component and they are initialised on component startup.