Hi,
Gabor's comment is a good topic to provide a CR to ETSI!
BR, Gyorgy
Original Message
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only [
This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Gábor Ziegler
Sent: Wednesday, 19 September, 2007 2:23 PM
To:
This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Component's variable
>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
> [
This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Pavel Yakovenko
> Sent: 2007. September 19, Wednesday 13:38
> To:
This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Component's variable
>
> Hi
>
> There are plenty of ways. You may use references to constants, module
> parameters and other component variables as well as function return
> values to initialize the variable.
> The another choice is to pass your variable as 'out'
> parameter to a function that initializes dummy variable located on the
> next line.
>
Just one note: using functions could result in nasty race-conditions, since a.f.a.i.k. the TTCN-3 semantics does not define any particular order of executing the variable instantiations of a component...
So, IMHO, wise people would just use "constant values" here (i.e., constants, module pars and literals), and write additional initialization functions to be explicitly invoked from the behavioral specification of the component. That is, that are explicitly invoked from either the test case body in case of the MTC; or from the function(s) bodi(es) that is (are) used as argument(s) to the start() operation(s) of the other PTC(s)
BR,
Gabor
Gábor Ziegler M.Sc.E.E., dr.univ
Test System Engineer
Test Competence Center
Ericsson Hungary Ltd.
Research & Development
Budapest, XI. Irinyi. J. u. 4-20.
www.ericsson.com
Office: +36 1 437 7361
Fax: +36 1 439 5176
Mobile: +30 30 219 9805
Email:
This email address is being protected from spambots. You need JavaScript enabled to view it.
Ericsson Magyarország Kft., Székhely: Budapest, Laborc u.1. Nyilvántartó cégbÃróság: FÅ‘városi BÃróság. Cégjegyzékszám: 01-09-070937
This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.
E-mail including attachments is susceptible to data corruption, interception, unauthorized amendment, tampering and viruses, and we only send and receive emails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.
> type octetstring ARR[2]
>
> type component CT
> {
> var ARR v1 := {INIT('00'O), INIT('11'O)} // use return value
> var ARR v2
> var boolean dummy := INIT_HELPER(v2) // use 'out' parameter }
>
> function INIT(octetstring u) return octetstring {
> return u;
> }
>
> function INIT_HELPER(out ARR u) return boolean {
> u[0] := '00'O;
> u[1] := '11'O;
> return true;
> }
>
> Best regards,
> Pavel Yakovenko
>
>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
> [
This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Csaba Bejan
> Sent: Wednesday, September 19, 2007 1:33 PM
> To:
This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Component's variable
>
> Hello!
>
> I have a question and i would like to ask your help is it's
> possible.
> I would like to define default values to my component's variables.
> e.g.: type component AComponent
> {
> var request_id_list_type
> request_id_list;
> }
>
> In this case i would like to define default starting value to the
> request_id_list which is an array from octetstrings.
>
> If this is not possible is there any way for creating a function
> which is called when the component is created (like a constructor in
> the C++).
>
> Thanks for your help in advance,
> Csaba
>