[gme-users] BON2 ExtenderInterpreter generated code and
traversing connections
Matthew J. Emerson
mjemerson at isis.vanderbilt.edu
Mon Sep 5 10:21:43 CDT 2005
Hi Ace.
When generating your domain-specific API with the BON Extender, you have
the option of generating simple getters, templated method getters, or
both.
Simple getters are not templated methods, so you don't have to specify
any additional template parameters upon invocation. For your example,
the simple getter declaration would be:
class A {
...
std::multiset<B> getConDsts (void);
...
};
Hth,
Matt
> -----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