[Mobies-commit] [commit] r3829 - in UDM/trunk/src: UML GME/Interpreter UdmBase
ksmyth at redhat1.isis.vanderbilt.edu
ksmyth at redhat1.isis.vanderbilt.edu
Tue Aug 16 14:21:07 CDT 2011
Author: ksmyth
Date: Tue Aug 16 14:21:07 2011
New Revision: 3829
Log:
Fix GReAT crosslinks if the crosslinks diagram has multiple inheritance.
Modified:
UDM/trunk/src/UML GME/Interpreter/BONComponent.cpp
UDM/trunk/src/UdmBase/Project.cpp
UDM/trunk/src/UdmBase/UdmStatic.cpp
Modified: UDM/trunk/src/UML GME/Interpreter/BONComponent.cpp
==============================================================================
--- UDM/trunk/src/UML GME/Interpreter/BONComponent.cpp Tue Aug 16 11:36:55 2011 (r3828)
+++ UDM/trunk/src/UML GME/Interpreter/BONComponent.cpp Tue Aug 16 14:21:07 2011 (r3829)
@@ -848,9 +848,11 @@
crole.target() = cross_uml_cls;
crole.min() = 0;
crole.max() = -1;
+ crole.name() = static_cast<std::string>(cross_uml_cls.name()) + "_childrole";
::Uml::CompositionParentRole prole = ::Uml::CompositionParentRole::Create(comp);
prole.target() = cont_class;
+ prole.name() = static_cast<std::string>(cross_uml_cls.name()) + "_parentrole";
}
CString CCompositeClass::GetName()
Modified: UDM/trunk/src/UdmBase/Project.cpp
==============================================================================
--- UDM/trunk/src/UdmBase/Project.cpp Tue Aug 16 11:36:55 2011 (r3828)
+++ UDM/trunk/src/UdmBase/Project.cpp Tue Aug 16 14:21:07 2011 (r3829)
@@ -838,7 +838,27 @@
if (!create) return Udm::null;
//placeholder was not found ... create it
- Object ph_object = root_object.CreateObject(Uml::SafeTypeContainer::GetSafeType(ph_class));
+ // Due to inheritance, an object may have multiple roles. CreateObject will fail if it is ambiguous.
+ // So just get any valid child role
+ Udm::Object::CompositionInfo compInfo;
+ {
+ // like matchChildToParent, but dups are fine
+ using namespace Uml;
+ set<Class> pancs = AncestorClasses(root_object.type());
+ set<Class> cancs = AncestorClasses(ph_class);
+ for (set<Class>::iterator j = cancs.begin(); j != cancs.end(); j++) {
+ set<CompositionChildRole> cr = (*j).childRoles();
+ for (set<CompositionChildRole>::iterator i = cr.begin(); i != cr.end(); i++) {
+ if (pancs.find(theOther(*i).target()) != pancs.end()) {
+ Uml::Composition comp;
+ comp = (*i).parent();
+ compInfo.strChildRoleName = i->name();
+ compInfo.strParentRoleName = theOther(*i).name();
+ }
+ }
+ }
+ }
+ Object ph_object = root_object.CreateObject(Uml::SafeTypeContainer::GetSafeType(ph_class), compInfo);
if(!ph_object.SetIntValue("rem_id", o.__impl()->uniqueId()))
throw udm_exception("SetIntValue failed when setting attribute rem_id!");
Modified: UDM/trunk/src/UdmBase/UdmStatic.cpp
==============================================================================
--- UDM/trunk/src/UdmBase/UdmStatic.cpp Tue Aug 16 11:36:55 2011 (r3828)
+++ UDM/trunk/src/UdmBase/UdmStatic.cpp Tue Aug 16 14:21:07 2011 (r3829)
@@ -1600,7 +1600,8 @@
if(!role)
{
::Uml::Composition comp = Uml::matchChildToParent(meta, m_type);
- if(!comp) throw udm_exception("Role must be specified for " + casestr);
+ if(!comp)
+ throw udm_exception("Role must be specified for " + casestr);
role = comp.childRole();
}
More information about the Mobies-commit
mailing list