Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Using a unbound optional field (record type optional field )
Using a unbound optional field [message #1804475] Tue, 26 March 2019 14:08 Go to next message
le tian is currently offline le tianFriend
Messages: 16
Registered: October 2018
Junior Member
There is an optional field in the record type I defined. When the optional area is empty, I don't assign a value. When I decode the record type with an external function, there is a "using an unbound optional field" error. How can I solve it?
Re: Using a unbound optional field [message #1804479 is a reply to message #1804475] Tue, 26 March 2019 15:39 Go to previous message
Botond Baranyi is currently offline Botond BaranyiFriend
Messages: 36
Registered: February 2016
Member
All fields of a record value must be initialized, even optional fields, before it can be used in most operations. If you don't want to give a real value to an optional field, you have to set it to 'omit'.

For example:
type record MyRecord {
  integer field1,
  charstring field2 optional
}
...
var MyRecord x1 := { field1 := 1, field2 := omit }


You can also set all uninitialized optional fields to 'omit' with the attribute 'optional "implicit omit"'.

For example:
var MyRecord x2 := { field1 := 2 } with { optional "implicit omit" }
Previous Topic:RIoT - the IoT load/performance generator based on TTCN-3 and Titan
Next Topic:RAW Encoder and Decoder
Goto Forum:
  


Current Time: Sun Jun 13 05:53:19 GMT 2021

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

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

Back to the top