[Mobies-commit] [commit] r4186 - GReAT/trunk/Tools/MetaGME2UMX

ksmyth at redhat3.isis.vanderbilt.edu ksmyth at redhat3.isis.vanderbilt.edu
Tue Aug 27 13:33:07 CDT 2013


Author: ksmyth
Date: Tue Aug 27 13:33:07 2013
New Revision: 4186

Log:
Not enough refport assocations: a Reference may have a descendant Reference that may be contained in the Refport Container

Modified:
   GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML_2.cpp

Modified: GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML_2.cpp
==============================================================================
--- GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML_2.cpp	Tue Aug 27 13:00:30 2013	(r4185)
+++ GReAT/trunk/Tools/MetaGME2UMX/MetaGME2UML_2.cpp	Tue Aug 27 13:33:07 2013	(r4186)
@@ -1316,15 +1316,23 @@
 	trans(port_container_refs_refertos_, baserefport_containers, std::mem_fun_ref(&MetaGME::ReferTo::srcReferTo_end));
 	std::set<MetaGME::BaseFCO> baserefport_containers_;
 	trans(baserefport_containers, baserefport_containers_, std::ptr_fun(&RefByProxy));
+#ifdef _DEBUG
+	std::vector<std::string> baserefport_containers_str;
+	std::transform(baserefport_containers.begin(), baserefport_containers.end(), std::back_inserter(baserefport_containers_str), std::ptr_fun(ExName));
+#endif
 	// references in refport_containers can only be refports if contained by something that can also contain the connection
 	// FIXME: a descendant of the other end of the connection must also be contained
-	std::set<MetaGME::BaseFCO> baserefport_containers__;
-	std::remove_copy_if(baserefport_containers_.begin(), baserefport_containers_.end(),
-		set_inserter(baserefport_containers__), 
-		std::not1(CanBeContainedInSameContainer(connection)));
+	for (std::set<MetaGME::BaseFCO>::iterator baserefport_containerIt = baserefport_containers_.begin(); baserefport_containerIt != baserefport_containers_.end();)
+	{
+		std::set<MetaGME::BaseFCO> subtypes = GetSelfAndSubtypes(*baserefport_containerIt);
+		if (std::any_of(subtypes.begin(), subtypes.end(), CanBeContainedInSameContainer(connection)))
+			baserefport_containerIt++;
+		else
+			baserefport_containers_.erase(baserefport_containerIt++);
+	}
 
 	MetaGME::Reference (*Reference_cast)(const Udm::Object&) = &MetaGME::Reference::Cast;
-	trans(baserefport_containers__, refport_containers, std::ptr_fun(Reference_cast));
+	trans(baserefport_containers_, refport_containers, std::ptr_fun(Reference_cast));
 	// FIXME: filter out subtypes of refport_containers
 	}
 


More information about the Mobies-commit mailing list