Hello,
I have a question connected with ttcn-3 - is it possible to retreive type of value from unin type var or retreive union value itself without explicit invocation?
My situation:
I have a list of union type values
type charstirng typeA with {extension "something"}
type charstirng typeB with {extension "somehing1"}
type union U
{
typeA a,
typeB b,
typeC c
}
type record of U R_of_U;
var R_of_U v_list := {c:={}, a:={...}, b:={...}, b:={...}};
I want to verify if my v_list is of typeA or typeB.
I did it with:
if (match(v_list, (a:={?}, b:={?})))
{
//here is my problem! If union value is of expected type - typeA or typeB then I want to retreive this value. Am I able to do that without checking
if (ischosen(v_list.a))
{
var charstring v_c := v_list.a;
...
}
//I can determine expected range of my union value, but is there
// any possibility to retreive this particular value implicitly without v_list.a or v_list.b?
// if not then I would have to repeat if (ischosen(...)) { char_var := v_list.a } in every case
// and such a code is not quite well readable
}
Could you plaese help me with this case?
Best regards,
Dominik