[gme-users] How to get the derived classes of one base class
inthe<<connection>>
Zoltan Molnar
zolmol at isis.vanderbilt.edu
Fri Jun 23 10:47:40 CDT 2006
The
BaseType bt=DataLink->getSrc();
Int myInt(bt);
form should 'work'.
At least this is the usual way of downcasting an element to its derived
type.
Could it happen that bt is actually not an Int but a Float?
Float myF( bt);
if( myF)
{
// success
}
Zoli
> -----Original Message-----
> From: gme-users-bounces at list.isis.vanderbilt.edu
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of ???
> Sent: Friday, June 23, 2006 9:27 AM
> To: gme-users
> Subject: [gme-users] How to get the derived classes of one
> base class in the<<connection>>
>
>
> hi,all
>
> I meet with a problem.In my meta-model, one <<connection>>
> called "DataLink" connects two Ends,the src is an abstract
> <<Atom>> called "BaseType", the dst is an <<atom>> called
> EditBox. two <<atom>>s called "Float" and "Int" inherit "BaseType".
>
>
> In my user-model,a true Int <<Atom>> connects a EditBox by a
> "DataLink" line.When developing interpreter,I want to get the
> Int class instead of BaseType class.But I only find the
> following method:
>
> BaseType DataLinkImpl::getSrc()
> {
> BON::ConnectionEnd ce = ConnectionImpl::getSrc();
> BaseType sp( ce);
> if ( sp)
> return sp;
>
> BaseType empty;
> return empty;
> }
>
>
> I try to translate base class "BastType" into "Int" or
> "Float" class by dynamic_cast<>, I failed.
>
> BaseType bt=DataLink->getSrc();
> Int myInt(bt);
>
> failed again.
>
> help me!! thanks!
>
>
> Z.G.Shu
>
> Ph.D Candidate
> College of Automation Engineering, South China University
> of Technology,
> Guangzhou, China.
> Phone: +86-20-87114637
> Email: zgshu2004 at 163.com
>
>
>
>
> _______________________________________________
> 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