[gme-users] BON2 ExtenderInterpreter generated code and traversing connections

Zoltan Molnar zolmol at isis.vanderbilt.edu
Tue Sep 6 11:40:48 CDT 2005


Answer for B:
The order in which objects are returned in BON is undefined. Some users
needed a way to specify their comparator, that is why these template
based getters were introduced.

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 Thompson, Robert C
> Sent: Saturday, September 03, 2005 7:23 PM
> To: gme-users
> Subject: [gme-users] BON2 ExtenderInterpreter generated code 
> and traversing connections
> 
> 
> Hi,
> 
> It seems that when the BON2 ExtenderInterpreter generates 
> code for traversing connectors, it allows (and forces) a 
> developer using the generated API to specify std::set and 
> std::multiset "2nd template parameter", which is the 
> comparator used by the template for comparing elements.
> 
> For example, if your metamodel has two classes A,B and a 
> connection between them "Con", BON2 Extender Interpreter 
> generates something like the following member function of class A:
> 
> class A { 
> ...
> template <class T> std::multiset<B, T> getConDsts (TDP) { ... } ... }
> 
> Now, if I'm utilizing this method somewhere, and I have an 
> instance "a1" of the BON2-EI-generated class representing 
> "A", the following seems to
> work:
> 
> B b1 = *(a1->getConDsts<std::less<B> >.begin() );
> 
> But the thing is I have to specify the std::less<B> 
> comparator class template parameter for every invocation of 
> "getConDsts()".
> 
> Of course I think I could hand-jam the 
> BON2ExtenderInterpreter and modify the method definition to 
> specify a default for the parameter value when I don't specify one:
> 
> template <class T=std::less<B> > std::multiset<B, T> 
> getConDsts (TDP) { ... }
> 
> The problem is I have quite a few of these in my metamodel 
> that I'd have to manually update every time I re-gen with the 
> Extender Interpreter. Not a show-stopper but slightly akward 
> in terms of the overall process.
> 
> My questions are: 
> 
> A) Is there something I could do differently to get around 
> this, am I missing something?
> B) What's the rationale for exposing that "comparator" 
> template parameter for specification by the call-site?
> C) What's the rationale for the generated code not specifying 
> a "default" such that the call-site doesn't _have_ to specify 
> a template parameter value?
> D) Would something like "C" be considered beneficial by anyone else?
> 
> Thanks
> -ace
> Ace Thompson
> Systems and Software Engineer
> FCS LSI C4ISR Battle Command
> robert.c.thompson3 at boeing.com
> +1 480 891 2284
> The Boeing Company
> 
> 
> _______________________________________________
> 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