[gme-users] second template argument for aggregated getter for setmembers?

Ace Thompson acethompson at igniteweb.net
Fri May 19 15:51:57 CDT 2006


Hi,

I apologize if this has come up before (I did try to find a related message
in the maillinglist archives but couldn't find one.)

When using the BON Extender Interpreter, and choosing the "template method"
option for generating getters, it seems that the generated code isn't quite
right for <<Set>> elements with respect to the template parameter used to
sort the std::set<> that will contain the contained elements when you get
them. 

For example, suppose I have a <<Model>> named M and a <<Set>> named S in my
model. Suppose they both "contain" an element named F.  (obviously the
containment is "model containment" for M, and "set containment" for S)

The interpreter generates the following "getter" for M to get "F":

	template <class T>
	std::set<F, T>		getF (TDP)
	{
		std::set<F, T> res;
		std::set<BON::FCO> roles = getChildFCOsAs("F");
		for( std::set<BON::FCO>::iterator i = roles.begin(); i !=
roles.end(); ++i)
		{
			F elem(*i);
			ASSERT(elem);
			res.insert(elem);
		}
		return res;
	}

The "getter" for S is slightly different:

	template <class T>
	std::set<F>		getF( int dummy, TDP)
	{
		std::set<F> res;
		std::set<BON::FCO> elems = BON::SetImpl::getMembers();
		std::set<BON::FCO>::iterator elem = elems.begin();
		for( ; elem != elems.end(); ++elem)
		{
			F r( *elem);
			if ( r)
				res.insert( r);
		}
		return res;
	}

Notice that in the second case the template parameter "T" isn't used.  The
workaround is to hand-jam it in there after you generate the code, which
isn't a big deal but I'm guessing either this wasn't the intent or there's
an extraneous template parameter on the method definition...

This is with GME 5.9.21 and uhm I'm not sure what version of the BON
Extender Interpreter but if that is relevant I can figure that out...

Thanks,
____________
Ace Thompson
Ignite Analytics Corporation
acethompson at igniteweb.net
m. 480 703 8909





More information about the gme-users mailing list