Skip to main content



      Home
Home » Eclipse Projects » Eclipse Titan » the PRESENCE useage(how to determine if an optional field exists)
the PRESENCE useage [message #1851062] Sat, 26 March 2022 00:13 Go to next message
Eclipse UserFriend
type record A{
    O1_Type    a_f1
    O1_Type    a_f2     optional,
    O2_Type    a_f3    optional,
};

type record B{
    B3_Type    b_f1,
    B5_Type    b_f2,
    record of    A   aaa  optional
};


I hope when b_f1 is '001'B or '010'B, the aaa is presence, and a_f2 and a_f3 is presence.

how can I do?

thanks

[Updated on: Sat, 26 March 2022 01:59] by Moderator

Re: the PRESENCE useage [message #1851105 is a reply to message #1851062] Mon, 28 March 2022 04:47 Go to previous message
Eclipse UserFriend
Hi,

There is an ispresent operator in TTCN-3 what checks whether a referenced field is present in a data object.

There are examples in the TTCN-3 Standard what you can find here : http://www.ttcn-3.org/index.php/downloads/standards

Or you can write your own ispresent function based on ispresent operator and your conditions. Something like this:
function my_ispresent(in B b_record) return boolean {
  if (b_record.b_f1 == '001'B or b_record.b_f1 == '010'B) {
    return ispresent(b_record.aaa);
  }
  return false;
}


Best regards,
Gergo
Previous Topic:the doubt about the function encvalue()
Next Topic:TTCN_Location in adapters (C++ code)
Goto Forum:
  


Current Time: Fri Jul 04 10:09:18 EDT 2025

Powered by FUDForum. Page generated in 0.32461 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top