Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 04:13 Go to next message
lou ban is currently offline lou banFriend
Messages: 17
Registered: June 2020
Junior Member
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 05:59]

Report message to a moderator

Re: the PRESENCE useage [message #1851105 is a reply to message #1851062] Mon, 28 March 2022 08:47 Go to previous message
Gergo Ujhelyi is currently offline Gergo UjhelyiFriend
Messages: 3
Registered: February 2021
Junior Member
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: Sat Oct 05 03:31:15 GMT 2024

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

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

Back to the top