[gme-users] Connection Ends and Reference Ports (BONInterpreter)

Zoltan Molnar zoltan.molnar at vanderbilt.edu
Fri Jun 4 13:34:55 CDT 2004


Hi,

Yes you're right: in the cases when reference ports might be involved in a
connection the return type of a getter can be only ConnectionEnd (this is
checked based on the metamodel).

Generally you can try to cast a ConnectionEnd to an FCO like 
"FCO myfco( myConnectionEnd); 
if ( myfco) { // success 
}"

It succeeds in cases when the ConnectionEnd is really an fco.

However, when the connectionend is a referenceport then the cast like: 
"ReferencePort refport( myConnectionEnd);" succeeds. 

Summarizing, you could use the following way to check a returned connection
end:

ConnectionEnd cend = ...; // given back by some getter
FCO dst( cend );
if (dst)
  // success
else
{
  ReferencePort rp( cend);
  if ( rp)
  {
    FCO fco = rp->getFCO(); // this fco is located in the model the
reference ( = referenceportcontainer) refers to
    ReferencePortContainer rpcont = rp->getContainer();
    Reference ref = rpcont->getReference(); // this is the reference object,
which points to the model containing the port
  }
}

Br,Zoli

> -----Original Message-----
> From: gme-users-bounces at list.isis.vanderbilt.edu 
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf 
> Of Jacques Kerner
> Sent: Friday, June 04, 2004 11:58 AM
> To: A list for GME users to share thoughts and discuss bugs and fixes.
> Subject: [gme-users] Connection Ends and Reference Ports 
> (BONInterpreter)
> 
> 
> Hi,
> 
> I have a question concerning Connections between reference 
> ports, I hope 
> somebody can tell me more about it.
> 
> I noticed that the BONInterpreter code generator creates getDst() and 
> getSrc() methods for all Connections it find in the meta 
> model, but the 
> returned type vary. It usually matches the types at the 
> connection ends, 
> but it can also be simply BON::ConnectionEnd which is somewhat 
> disturbing, since I was not able to get the concrete FCO that is 
> targeted by the Connection End. I also noticed (maybe I am 
> wrong) that 
> it happens whenever the BONInterpreter code generator dtects 
> there might 
> be a risk that the connection in fact connects reference 
> ports together 
> (there is a function isReferencePort in ConnectionEnd, that 
> lead me to 
> think that it is a special case). Hence my question :
> 
> When a getDst() or getSrc() returns type BON::ConnectionEnd, how do I 
> get back to the real concrete FCO targeted ? Is it normal that the 
> getDst and getSrc function return BON::ConnectionEnd at all 
> instead of 
> the real type, like for other Connections...
> 
> Hope someone understands my question. Thank you.
> 
> Jacques Kerner.
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
> 



More information about the gme-users mailing list