Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: what does it imply by saying that optional fields shall be omitted using ...

what does it imply by saying that optional fields shall be omitted using ... 02 Jun 2003 07:45 #6487

Hi guys,

I think I need to correct you here, Clause. The 'omit' symbol may well be used also outside templates, e.g., to marke fields in a value as being omitted. Example

type record MyType {
integer x optional;
integer y optional
}

var MyType r1 := { omit, omit };
var MyType r2 := { -, - }; // value list notations
var MyType r3 := { }; // assignment list notation, empty list

After this, r2 and r3 have the same structure, but this structure is different from the structur of r1. r1 is a fully defined value (whith two omitted fileds), which can, e.g., be used in a send statement. r2 and r3 have two _undefined_ (not omitted) fields, and using r2 or r3 in a send statement will cause a run time error.

Also, while

if (r1.x == omit) { ... }

will work nicely,

if (r2.x == omit) { ... }

will cause a run time error due to a read access to an undefined field.

So, in other words, and to come back to the original question: the only way to set an optional field to the 'omitted' state, the omit keywords must be used. Of course, it can also be used in templates to match optional fields that have been omitted.

BR

Stephan Tobies

Original Message
From: ext Claude Desroches [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: 01. June 2003 16:32
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: what does it imply by saying that optional fields shall be omitted using ...


In einer eMail vom 5/30/03 4:01:44 AM W. Europe Daylight Time schreibt This email address is being protected from spambots. You need JavaScript enabled to view it.:




Hello,TTCN3



Hi,



In the clause 6.3.1.0(ETSI ES 201 873-1 V2.2.1(2003-2)),there is a sentence that
Optional fields shall be omitted using the omit symbol.




The omit symbol is 'omit' (not to be confused with dash ( -).
The omit symbol is only to be used in templates.

When a field is declared as being optional, it means that it may be present or it may
be absent.



If the optional field has been assigned with non-omit value, will the value of the field be changed by assigning the omit to it.


You'll have to give more context with respect to your question for a complete answer.

>For example:
> type record MyRecord
> {
> integer field1 optional,
> boolean field2
> }
>
> var MyRecord r1;
> r1 := {10,true};

The above is a valid assignment. Each field in your record has a 'concrete' value.

. //after the assignment,is the value of r1.field1 equal to 10?
r1 := {omit,true};

The above is not legal TTCN-3. r1 would need to be declared as a template for this
to be valid.

If one assumes that r1 is defined as a template, then the above is valid, and r1.field will
now be absent if it is sent.


Comments anyone?

For some of us, the issue of assigning wildcards (matching mechanisms) to variables, elements of a record, or set is somewhat unclear. :-).

Hope this helps.


Cheers,


Claude.

Claude Desroches email: This email address is being protected from spambots. You need JavaScript enabled to view it.



Conformance Technologies CDE email: This email address is being protected from spambots. You need JavaScript enabled to view it.
685 Cedar Point Road phone: +1 705 533 23 94
Penetanguishene, Ontario
Canada
L9M 1R3

Claude Desroches email: This email address is being protected from spambots. You need JavaScript enabled to view it.
Solonplatz 3 phone: +49 30 9606 7986
13088 Berlin fax: +49 30 9606 7987
Germany
The administrator has disabled public write access.

what does it imply by saying that optional fields shall be omitted using ... 02 Jun 2003 08:34 #6491

Hi Claude,

(sorry about the Freudian mispelling in the earlier mail!).

'omit' is not a matching expression, it is a value (see BNF clause 434). So there is not problem with using omit inside values and templates, just like 42 or "Some funny string" can be used in templates.

For matching symbols like '*' or '?', the story is of course different. They are not values and may only appear inside templates.

BR

Stephan Tobies

Original Message
From: ext Claude Desroches [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: 02. June 2003 09:57
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: what does it imply by saying that optional fields shall be omitted using ...


In einer eMail vom 6/2/03 9:45:44 AM W. Europe Daylight Time schreibt This email address is being protected from spambots. You need JavaScript enabled to view it.:




Hi guys,

I think I need to correct you here, Clause.



I might be getting rusty :-). By all means, if I've fibbed, do correct me.

The 'omit' symbol may well be used also outside templates, e.g., to marke fields in a value


as being omitted.



Would this not also imply that all other matching mechanisms can be used outside of
templates? or is omit a special case?


Example




type record MyType {
integer x optional;
integer y optional
}

var MyType r1 := { omit, omit };
var MyType r2 := { -, - }; // value list notations
var MyType r3 := { }; // assignment list notation, empty list

After this, r2 and r3 have the same structure, but this structure is different from the structur of r1. r1 is a fully defined value (whith two omitted fileds), which can, e.g., be used in a send statement. r2 and r3 have two _undefined_ (not omitted) fields, and using r2 or r3 in a send statement will cause a run time error.






Also, while

if (r1.x == omit) { ... }

will work nicely,

if (r2.x == omit) { ... }

will cause a run time error due to a read access to an undefined field.

So, in other words, and to come back to the original question: the only way to set an optional field to the 'omitted' state, the omit keywords must be used. Of course, it can also be used in templates to match optional fields that have been omitted.

BR

Stephan Tobies







Claude Desroches email: This email address is being protected from spambots. You need JavaScript enabled to view it.
Solonplatz 3 phone: +49 30 9606 7985
13088 Berlin fax: +49 30 9606 7987
Germany
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin