[gme-users] Invoking the validation check from the interpreter

Peter Volgyesi peter.volgyesi at vanderbilt.edu
Thu Jun 3 17:24:12 CDT 2004


There is no easy way to invoke the Contraint Manager from your BON2
interpreter. (You have to use raw COM and some tricks).
I have attached a ready to use code snippet (eg.: you can place it in
"Component::invokeEx" or somewhere else in your interpreter):
----------------------------------
	CComPtr<IMgaProject> mgaProject = project->getProjectI();
	ASSERT(mgaProject);

	CComPtr<IMgaComponents> comps;
	COMTHROW( mgaProject->get_AddOnComponents(&comps));
	ASSERT(comps);

	CComPtr<IMgaComponentEx> mgaConstMgr;

	MGACOLL_ITERATE(IMgaComponent, comps) {
		CComBSTR name;
		COMTHROW(MGACOLL_ITER->get_ComponentName(&name));
		CString cname(name);
		if(cname == _T("ConstraintManager")) {
			mgaConstMgr =
CComQIPtr<IMgaComponentEx>(MGACOLL_ITER); 
			ASSERT(mgaConstMgr);
			break;
		}
	} MGACOLL_ITERATE_END;

	if (mgaConstMgr) {
		CComPtr<IMgaTerritory> terr;
		COMTHROW( mgaProject->get_ActiveTerritory(&terr));
		ASSERT(terr);

		COMTHROW( mgaProject->CommitTransaction() );
		mgaConstMgr->ObjectsInvokeEx(mgaProject, NULL, NULL, NULL);
		COMTHROW( mgaProject->BeginTransaction(terr) );
	}
----------------------------------

--
peter

> -----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: Wednesday, June 02, 2004 4:45 PM
> To: A list for GME users to share thoughts and discuss bugs and fixes.
> Subject: [gme-users] Invoking the validation check from the 
> interpreter
> 
> Hi,
> 
> I was wondering if it is possible to invoke the validation 
> check from interpreters, and get the result of it (number of 
> errors, ...)
> 
> Thanks in advance.
> 
> 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