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

TOPIC:

function / template override 15 Aug 2007 11:45 #7184

Hi,
I have a question. Is there any function override (or template
override) possibilities in TTCN3?

Because there is a common directory in which templates, functions,
message-sequences can be found. Every TTCN project imports these
modules.

But in some cases i.e. one or two sent messages is slightly different
from the ones in common directory. However, I don't want to create new
template or low level functions because than I cannot use the high
level common functions.

If I redefined somehow them using the same name, there could not be
any problem, and the code could remain more compact.

Thanks in advance.
Br
Csaba

Please Log in to join the conversation.

function / template override 15 Aug 2007 11:54 #7185

Hi Csaba, you can use the term "modifies" to "override" the template.
For example:

template GenericParam a_sigCompParam := {
id := "comp",
pValue := "sigcomp"
}

template GenericParam a_anyCompParam modifies a_sigCompParam := {
pValue := ?
}

Regards, Adriana

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, August 15, 2007 8:45 AM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: function / template override

Hi,
I have a question. Is there any function override (or template
override) possibilities in TTCN3?

Because there is a common directory in which templates, functions,
message-sequences can be found. Every TTCN project imports these
modules.

But in some cases i.e. one or two sent messages is slightly different
from the ones in common directory. However, I don't want to create new
template or low level functions because than I cannot use the high
level common functions.

If I redefined somehow them using the same name, there could not be
any problem, and the code could remain more compact.

Thanks in advance.
Br
Csaba

Please Log in to join the conversation.

function / template override 15 Aug 2007 12:31 #7186

Hi!

Thanks but unfortunatley the situation is a little more complicated. I
have big pre-defined templates and functions in our common structure,
but for some cases a few functionalities has to be modified.
For example I have common template: A.
But in some cases I need bit modified A template but with the _same
name. Can I override an existing template?

Thanks in advance,
Csaba

On 8/15/07, Adriana K. Kawai <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:
> Hi Csaba, you can use the term "modifies" to "override" the template.
> For example:
>
> template GenericParam a_sigCompParam := {
> id := "comp",
> pValue := "sigcomp"
> }
>
> template GenericParam a_anyCompParam modifies a_sigCompParam := {
> pValue := ?
> }
>
> Regards, Adriana
>
>
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, August 15, 2007 8:45 AM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: function / template override
>
> Hi,
> I have a question. Is there any function override (or template
> override) possibilities in TTCN3?
>
> Because there is a common directory in which templates, functions,
> message-sequences can be found. Every TTCN project imports these
> modules.
>
> But in some cases i.e. one or two sent messages is slightly different
> from the ones in common directory. However, I don't want to create new
> template or low level functions because than I cannot use the high
> level common functions.
>
> If I redefined somehow them using the same name, there could not be
> any problem, and the code could remain more compact.
>
> Thanks in advance.
> Br
> Csaba
>

Please Log in to join the conversation.

function / template override 15 Aug 2007 12:51 #7187

Hi Csaba,

Here are possibilities that come to my mind:

(a) use parameterized templates;

(b) you can use the 'modifies' clause inline without defining a new template, e.g. like that:

myPort.send(modifies A := { myModifiedField := myNewValue });
myPort.receive(modifies A := { myModifiedField := myNewValue });

Hope this helps,
Alexey

Csaba Bejan <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote: Hi!

Thanks but unfortunatley the situation is a little more complicated. I
have big pre-defined templates and functions in our common structure,
but for some cases a few functionalities has to be modified.
For example I have common template: A.
But in some cases I need bit modified A template but with the _same
name. Can I override an existing template?

Thanks in advance,
Csaba

On 8/15/07, Adriana K. Kawai wrote:
> Hi Csaba, you can use the term "modifies" to "override" the template.
> For example:
>
> template GenericParam a_sigCompParam := {
> id := "comp",
> pValue := "sigcomp"
> }
>
> template GenericParam a_anyCompParam modifies a_sigCompParam := {
> pValue := ?
> }
>
> Regards, Adriana
>
>
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, August 15, 2007 8:45 AM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: function / template override
>
> Hi,
> I have a question. Is there any function override (or template
> override) possibilities in TTCN3?
>
> Because there is a common directory in which templates, functions,
> message-sequences can be found. Every TTCN project imports these
> modules.
>
> But in some cases i.e. one or two sent messages is slightly different
> from the ones in common directory. However, I don't want to create new
> template or low level functions because than I cannot use the high
> level common functions.
>
> If I redefined somehow them using the same name, there could not be
> any problem, and the code could remain more compact.
>
> Thanks in advance.
> Br
> Csaba
>

Please Log in to join the conversation.

function / template override 15 Aug 2007 12:51 #7188

Hello Csaba,

There are three possibilities:
1) You can modify a template also in a send/receive statement.
2) If your common template A is defined in a module m. And you need the
modified version of A in a module named n. Then you can import A from m
to the module n and inside n define also A
template <type> A modifies m:A := ...
Inside the module n, A will refer to the template defined in n, whereas
m:A refers to A defined in m.
3) You use a component variable to store the template. In this case you
can update this template througout execution and always refer to it
using the same name.

Whether this solves your problem, I do not know. Besides the use of a
component variable, there is no overriding of definitions. Also, as a
kind of general warning, if you use the same identifier to mean
different things, then you should know very well what you are doing.
There is quite some risk to create confusion.

Hope this helps you further.

Best regards

Thomas


>
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 ext Csaba Bejan
>Sent: Wednesday, 15. August 2007 14:32
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: function / template override
>
>Hi!
>
>Thanks but unfortunatley the situation is a little more
>complicated. I have big pre-defined templates and functions in
>our common structure, but for some cases a few functionalities
>has to be modified.
>For example I have common template: A.
>But in some cases I need bit modified A template but with the
>_same name. Can I override an existing template?
>
>Thanks in advance,
>Csaba
>
>On 8/15/07, Adriana K. Kawai <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:
>> Hi Csaba, you can use the term "modifies" to "override" the template.
>> For example:
>>
>> template GenericParam a_sigCompParam := { id := "comp", pValue :=
>> "sigcomp"
>> }
>>
>> template GenericParam a_anyCompParam modifies a_sigCompParam := {
>> pValue := ?
>> }
>>
>> Regards, Adriana
>>
>>
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, August 15, 2007 8:45 AM
>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>> Subject: function / template override
>>
>> Hi,
>> I have a question. Is there any function override (or template
>> override) possibilities in TTCN3?
>>
>> Because there is a common directory in which templates, functions,
>> message-sequences can be found. Every TTCN project imports these
>> modules.
>>
>> But in some cases i.e. one or two sent messages is slightly
>different
>> from the ones in common directory. However, I don't want to
>create new
>> template or low level functions because than I cannot use the high
>> level common functions.
>>
>> If I redefined somehow them using the same name, there could not be
>> any problem, and the code could remain more compact.
>>
>> Thanks in advance.
>> Br
>> Csaba
>>
>

Please Log in to join the conversation.

function / template override 15 Aug 2007 12:53 #7189

Dear Csaba,

unfortunately I do not see a big chance to do this.
As I understood playing around with different module names does not seem
to be an option for you.

On the other hand, give template returning functions and template
variables a chance. This two concepts have been introduced recently into
the language to solve this type of problems.

Best regards, Theo


Csaba Bejan schrieb:
> Hi!
>
> Thanks but unfortunatley the situation is a little more complicated. I
> have big pre-defined templates and functions in our common structure,
> but for some cases a few functionalities has to be modified.
> For example I have common template: A.
> But in some cases I need bit modified A template but with the _same
> name. Can I override an existing template?
>
> Thanks in advance,
> Csaba
>
> On 8/15/07, Adriana K. Kawai <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:
>> Hi Csaba, you can use the term "modifies" to "override" the template.
>> For example:
>>
>> template GenericParam a_sigCompParam := {
>> id := "comp",
>> pValue := "sigcomp"
>> }
>>
>> template GenericParam a_anyCompParam modifies a_sigCompParam := {
>> pValue := ?
>> }
>>
>> Regards, Adriana
>>
>>
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, August 15, 2007 8:45 AM
>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>> Subject: function / template override
>>
>> Hi,
>> I have a question. Is there any function override (or template
>> override) possibilities in TTCN3?
>>
>> Because there is a common directory in which templates, functions,
>> message-sequences can be found. Every TTCN project imports these
>> modules.
>>
>> But in some cases i.e. one or two sent messages is slightly different
>> from the ones in common directory. However, I don't want to create new
>> template or low level functions because than I cannot use the high
>> level common functions.
>>
>> If I redefined somehow them using the same name, there could not be
>> any problem, and the code could remain more compact.
>>
>> Thanks in advance.
>> Br
>> Csaba
>>
>

Please Log in to join the conversation.

function / template override 15 Aug 2007 14:34 #7190

Hi,

Currently no override/overloading is supported by the language but pls. pay attention to CR406 on non-mandatory parameters (parameters with default values). This would allow updating the behaviour of existing (library) templates/functions while leaving the interface backward compatible.

Unfortunately the CR is not approved yet and the feature is currently supported by the Ericsson tool only - at least to my knowledge. However, the CR could be approved this autumn as a new TTCN-3 edition is due by the end of this year.

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
>Theofanis Vassiliou-Gioles
>Sent: Wednesday, 2007 August 15. 02:54 PM
>To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>Subject: Re: function / template override
>
>Dear Csaba,
>
>unfortunately I do not see a big chance to do this.
>As I understood playing around with different module names
>does not seem
>to be an option for you.
>
>On the other hand, give template returning functions and template
>variables a chance. This two concepts have been introduced
>recently into
>the language to solve this type of problems.
>
>Best regards, Theo
>
>
>Csaba Bejan schrieb:
>> Hi!
>>
>> Thanks but unfortunatley the situation is a little more
>complicated. I
>> have big pre-defined templates and functions in our common structure,
>> but for some cases a few functionalities has to be modified.
>> For example I have common template: A.
>> But in some cases I need bit modified A template but with the _same
>> name. Can I override an existing template?
>>
>> Thanks in advance,
>> Csaba
>>
>> On 8/15/07, Adriana K. Kawai <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:
>>> Hi Csaba, you can use the term "modifies" to "override" the
>template.
>>> For example:
>>>
>>> template GenericParam a_sigCompParam := {
>>> id := "comp",
>>> pValue := "sigcomp"
>>> }
>>>
>>> template GenericParam a_anyCompParam modifies a_sigCompParam := {
>>> pValue := ?
>>> }
>>>
>>> Regards, Adriana
>>>
>>>
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, August 15, 2007 8:45 AM
>>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
>>> Subject: function / template override
>>>
>>> Hi,
>>> I have a question. Is there any function override (or template
>>> override) possibilities in TTCN3?
>>>
>>> Because there is a common directory in which templates, functions,
>>> message-sequences can be found. Every TTCN project imports these
>>> modules.
>>>
>>> But in some cases i.e. one or two sent messages is slightly
>different
>>> from the ones in common directory. However, I don't want to
>create new
>>> template or low level functions because than I cannot use the high
>>> level common functions.
>>>
>>> If I redefined somehow them using the same name, there could not be
>>> any problem, and the code could remain more compact.
>>>
>>> Thanks in advance.
>>> Br
>>> Csaba
>>>
>>
>

Please Log in to join the conversation.

function / template override 15 Aug 2007 14:36 #7191

  • G
  • G's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
A function referenciat is emlithetted volnad ;)

Gábor Ziegler M.Sc.E.E., dr.univ
Test System Engineer
Test Competence Center
IJ/ETH

Ericsson Hungary Ltd.
Research & Development
ECN: 831 7361
Web: mwlx122.eth.ericsson.se:8081/~egbozie



>
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 György
> Réthy (IJ/ETH)
> Sent: 2007. augusztus 15. 16:35
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: function / template override
>
> Hi,
>
> Currently no override/overloading is supported by the
> language but pls. pay attention to CR406 on non-mandatory
> parameters (parameters with default values). This would allow
> updating the behaviour of existing (library)
> templates/functions while leaving the interface backward compatible.
>
> Unfortunately the CR is not approved yet and the feature is
> currently supported by the Ericsson tool only - at least to
> my knowledge. However, the CR could be approved this autumn
> as a new TTCN-3 edition is due by the end of this year.
>
> 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
> >Theofanis Vassiliou-Gioles
> >Sent: Wednesday, 2007 August 15. 02:54 PM
> >To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> >Subject: Re: function / template override
> >
> >Dear Csaba,
> >
> >unfortunately I do not see a big chance to do this.
> >As I understood playing around with different module names
> >does not seem
> >to be an option for you.
> >
> >On the other hand, give template returning functions and template
> >variables a chance. This two concepts have been introduced
> >recently into
> >the language to solve this type of problems.
> >
> >Best regards, Theo
> >
> >
> >Csaba Bejan schrieb:
> >> Hi!
> >>
> >> Thanks but unfortunatley the situation is a little more
> >complicated. I
> >> have big pre-defined templates and functions in our common
> structure,
> >> but for some cases a few functionalities has to be modified.
> >> For example I have common template: A.
> >> But in some cases I need bit modified A template but with the _same
> >> name. Can I override an existing template?
> >>
> >> Thanks in advance,
> >> Csaba
> >>
> >> On 8/15/07, Adriana K. Kawai <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:
> >>> Hi Csaba, you can use the term "modifies" to "override" the
> >template.
> >>> For example:
> >>>
> >>> template GenericParam a_sigCompParam := {
> >>> id := "comp",
> >>> pValue := "sigcomp"
> >>> }
> >>>
> >>> template GenericParam a_anyCompParam modifies a_sigCompParam := {
> >>> pValue := ?
> >>> }
> >>>
> >>> Regards, Adriana
> >>>
> >>>
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, August 15, 2007 8:45 AM
> >>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> >>> Subject: function / template override
> >>>
> >>> Hi,
> >>> I have a question. Is there any function override (or template
> >>> override) possibilities in TTCN3?
> >>>
> >>> Because there is a common directory in which templates, functions,
> >>> message-sequences can be found. Every TTCN project imports these
> >>> modules.
> >>>
> >>> But in some cases i.e. one or two sent messages is slightly
> >different
> >>> from the ones in common directory. However, I don't want to
> >create new
> >>> template or low level functions because than I cannot use the high
> >>> level common functions.
> >>>
> >>> If I redefined somehow them using the same name, there
> could not be
> >>> any problem, and the code could remain more compact.
> >>>
> >>> Thanks in advance.
> >>> Br
> >>> Csaba
> >>>
> >>
> >
>

Please Log in to join the conversation.

function / template override 16 Aug 2007 10:34 #7192

Hi,
Thanks for the lot of ideas.

Gyorgy: I don't think so that our tool supports such kind of solution
you suggested.
Thomas: your idea can really work. Using import with "except" there is
a way to use my new "A" template and not the common one without any
restrictoin to other common things.

Thanks for all of you.

Br,
Csaba


On 8/15/07, Gábor Ziegler (IJ/ETH) <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:
> A function referenciat is emlithetted volnad ;)
>
> Gábor Ziegler M.Sc.E.E., dr.univ
> Test System Engineer
> Test Competence Center
> IJ/ETH
>
> Ericsson Hungary Ltd.
> Research & Development
> ECN: 831 7361
> Web: mwlx122.eth.ericsson.se:8081/~egbozie
>
>
>
> >
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 György
> > Réthy (IJ/ETH)
> > Sent: 2007. augusztus 15. 16:35
> > To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> > Subject: Re: function / template override
> >
> > Hi,
> >
> > Currently no override/overloading is supported by the
> > language but pls. pay attention to CR406 on non-mandatory
> > parameters (parameters with default values). This would allow
> > updating the behaviour of existing (library)
> > templates/functions while leaving the interface backward compatible.
> >
> > Unfortunately the CR is not approved yet and the feature is
> > currently supported by the Ericsson tool only - at least to
> > my knowledge. However, the CR could be approved this autumn
> > as a new TTCN-3 edition is due by the end of this year.
> >
> > 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
> > >Theofanis Vassiliou-Gioles
> > >Sent: Wednesday, 2007 August 15. 02:54 PM
> > >To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> > >Subject: Re: function / template override
> > >
> > >Dear Csaba,
> > >
> > >unfortunately I do not see a big chance to do this.
> > >As I understood playing around with different module names
> > >does not seem
> > >to be an option for you.
> > >
> > >On the other hand, give template returning functions and template
> > >variables a chance. This two concepts have been introduced
> > >recently into
> > >the language to solve this type of problems.
> > >
> > >Best regards, Theo
> > >
> > >
> > >Csaba Bejan schrieb:
> > >> Hi!
> > >>
> > >> Thanks but unfortunatley the situation is a little more
> > >complicated. I
> > >> have big pre-defined templates and functions in our common
> > structure,
> > >> but for some cases a few functionalities has to be modified.
> > >> For example I have common template: A.
> > >> But in some cases I need bit modified A template but with the _same
> > >> name. Can I override an existing template?
> > >>
> > >> Thanks in advance,
> > >> Csaba
> > >>
> > >> On 8/15/07, Adriana K. Kawai <This email address is being protected from spambots. You need JavaScript enabled to view it.> wrote:
> > >>> Hi Csaba, you can use the term "modifies" to "override" the
> > >template.
> > >>> For example:
> > >>>
> > >>> template GenericParam a_sigCompParam := {
> > >>> id := "comp",
> > >>> pValue := "sigcomp"
> > >>> }
> > >>>
> > >>> template GenericParam a_anyCompParam modifies a_sigCompParam := {
> > >>> pValue := ?
> > >>> }
> > >>>
> > >>> Regards, Adriana
> > >>>
> > >>>
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, August 15, 2007 8:45 AM
> > >>> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> > >>> Subject: function / template override
> > >>>
> > >>> Hi,
> > >>> I have a question. Is there any function override (or template
> > >>> override) possibilities in TTCN3?
> > >>>
> > >>> Because there is a common directory in which templates, functions,
> > >>> message-sequences can be found. Every TTCN project imports these
> > >>> modules.
> > >>>
> > >>> But in some cases i.e. one or two sent messages is slightly
> > >different
> > >>> from the ones in common directory. However, I don't want to
> > >create new
> > >>> template or low level functions because than I cannot use the high
> > >>> level common functions.
> > >>>
> > >>> If I redefined somehow them using the same name, there
> > could not be
> > >>> any problem, and the code could remain more compact.
> > >>>
> > >>> Thanks in advance.
> > >>> Br
> > >>> Csaba
> > >>>
> > >>
> > >
> >
>

Please Log in to join the conversation.

  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin