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

TOPIC: Query regarding virtual component.

Query regarding virtual component. 27 Jun 2008 10:37 #7368

Hi,



I need some help.



I have a function that runs on a virtual component. This function is
being called from two different components.



Now at run time, is there any way through which I can know, inside the
body of the shared function as to which component was this function
actually called from.



As one solution I could have passed some parameters in the shared
function that could identify the component name. But the problem is,
that I cannot change the signature of the shared function.



The picture below explains my problem in detail.













Thanks in advance,



Vikas
The administrator has disabled public write access.

Query regarding virtual component. 27 Jun 2008 11:09 #7370

  • Antti Hyrkk
  • Antti Hyrkk's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 43
  • Karma: 0
Can you be more specific what you are attempting to do? You can use the "self" reference in SharedFunction to get the reference of the executing component.



// Antti Hyrkkänen @ Plenware
// www.plenware.fi/en <www.plenware.fi/en>

________________________________

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 Singh, Vikaspratap (NSN - IN/Bangalore)
Sent: 27. kesäkuuta 2008 13:38
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Query regarding virtual component.



Hi,



I need some help.



I have a function that runs on a virtual component. This function is being called from two different components.



Now at run time, is there any way through which I can know, inside the body of the shared function as to which component was this function actually called from.



As one solution I could have passed some parameters in the shared function that could identify the component name. But the problem is, that I cannot change the signature of the shared function.



The picture below explains my problem in detail.













Thanks in advance,



Vikas
The administrator has disabled public write access.

Query regarding virtual component. 27 Jun 2008 11:27 #7371

I want to initialize a variable with the relevant values based on which component this function is called from.



"self" will give me the reference of the executing component but I'm not sure if I can use it in a conditional statement.



function SharefFunction() runs on virtualComponent {



boolean flag;



if( called from component_1 ) {

flag := true

}



if( called from component_2 {

flag := false



}



}



Best Regards,

Vikas



________________________________

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 Antti Hyrkkänen
Sent: Friday, June 27, 2008 4:39 PM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Query regarding virtual component.



Can you be more specific what you are attempting to do? You can use the "self" reference in SharedFunction to get the reference of the executing component.



// Antti Hyrkkänen @ Plenware
// www.plenware.fi/en <www.plenware.fi/en>

________________________________

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 Singh, Vikaspratap (NSN - IN/Bangalore)
Sent: 27. kesäkuuta 2008 13:38
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Query regarding virtual component.



Hi,



I need some help.



I have a function that runs on a virtual component. This function is being called from two different components.



Now at run time, is there any way through which I can know, inside the body of the shared function as to which component was this function actually called from.



As one solution I could have passed some parameters in the shared function that could identify the component name. But the problem is, that I cannot change the signature of the shared function.



The picture below explains my problem in detail.













Thanks in advance,



Vikas
The administrator has disabled public write access.

Query regarding virtual component. 27 Jun 2008 11:52 #7372

  • Antti Hyrkk
  • Antti Hyrkk's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 43
  • Karma: 0
Since you cannot change the parameters of this SharedFunction for some reason, you can pass the required information via the component type definition. Specify a variable in the component type that specifies how SharedFunction should behave:



type component virtualComponent

{

var integer componentType;

}



component_1 and component_2 type definitions must contain this variable also if this approach is used.

// Antti Hyrkkänen @ Plenware
// www.plenware.fi/en <www.plenware.fi/en>

________________________________

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 Singh, Vikaspratap (NSN - IN/Bangalore)
Sent: 27. kesäkuuta 2008 14:27
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Query regarding virtual component.



I want to initialize a variable with the relevant values based on which component this function is called from.



"self" will give me the reference of the executing component but I'm not sure if I can use it in a conditional statement.



function SharefFunction() runs on virtualComponent {



boolean flag;



if( called from component_1 ) {

flag := true

}



if( called from component_2 {

flag := false



}



}



Best Regards,

Vikas



________________________________

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 Antti Hyrkkänen
Sent: Friday, June 27, 2008 4:39 PM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Query regarding virtual component.



Can you be more specific what you are attempting to do? You can use the "self" reference in SharedFunction to get the reference of the executing component.



// Antti Hyrkkänen @ Plenware
// www.plenware.fi/en <www.plenware.fi/en>

________________________________

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 Singh, Vikaspratap (NSN - IN/Bangalore)
Sent: 27. kesäkuuta 2008 13:38
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Query regarding virtual component.



Hi,



I need some help.



I have a function that runs on a virtual component. This function is being called from two different components.



Now at run time, is there any way through which I can know, inside the body of the shared function as to which component was this function actually called from.



As one solution I could have passed some parameters in the shared function that could identify the component name. But the problem is, that I cannot change the signature of the shared function.



The picture below explains my problem in detail.













Thanks in advance,



Vikas
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin