Skip to main content



      Home
Home » Eclipse Projects » Eclipse Titan » variable definition(variable definition)
variable definition [message #1803407] Thu, 28 February 2019 03:39 Go to next message
Eclipse UserFriend
In TTCN-3, can static variables and global variables be defined as C? What should I do if I need to define data in this way?
Re: variable definition [message #1803413 is a reply to message #1803407] Thu, 28 February 2019 04:47 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
in TTCN-3 there is no such as global variable but it has much more scope than C has.

Static global variable and static function variable do'nt exist in TTCN-3 but component variables are similar to class member variables in C++ and Java.

Not every scope has variable, e.g module level variables do not exist.
Let me refer to the paragraph 5.2.0 first part of the TTCN-3 standards, ETSI ES 201 873-1, https://www.etsi.org/deliver/etsi_es/201800_201899/20187301/04.02.01_60/es_20187301v040201p.pdf:
TTCN-3 provides nine basic units of scope:
a) module definitions part;
b) control part of a module;
c) component types;
d) functions;
e) altsteps;
f) test cases;
g) statement blocks;
h) templates;
i) user defined named types.

There is a scope hierarcy discussed in 5.2.0.


I would suggest to read the standard mentioned above.
I would also suggest the ttcn3-courses, especially the first, https://www.eclipse.org/downloads/download.php?file=/titan/TTCN3_Course_PartI_EclipseLicensed.pdf

Best regards
Jeno
Re: variable definition [message #1803415 is a reply to message #1803413] Thu, 28 February 2019 04:58 Go to previous message
Eclipse UserFriend
Hi Le Tian,

the lack of global variables is intentional, and has the following philosophy:

components are being used to simulate separate nodes in TTCN-3 ; these nodes can be physically distinct, located in different geographical positions etc.
in the physical reality they are forced to communicate among themselves over physical channels that present an amount of latency /delay.

Simulations are forced, in lack of global variables, to use connections (e.g. internal ports) between components that are the equivalent of the above physical channels.
If global variables would exist, components could communicate with each other using such shared variables, which would lead to an unrealistic simulation.


So lack of global variables is more a feature that enforces a discipline and a way of thinking than a missing language element.


Best regards
Elemer


Previous Topic:patch: Print symbolic version in "compiler -v"
Next Topic:Data operation
Goto Forum:
  


Current Time: Sun Jul 27 09:31:14 EDT 2025

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

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

Back to the top