[Mobies-commit] [commit] r4139 - in UDM/trunk: include src/UdmBase src/UdmDom src/UdmUtil

endre at redhat1.isis.vanderbilt.edu endre at redhat1.isis.vanderbilt.edu
Mon Dec 10 07:20:01 CST 2012


Author: endre
Date: Mon Dec 10 07:20:01 2012
New Revision: 4139

Log:
isHelperAssociation() fine tunning 
additional typedef in order to avoid multimap<multimap<>> - >> is considered as left-shift by g++

Modified:
   UDM/trunk/include/UdmDom.h
   UDM/trunk/include/UdmUtil.h
   UDM/trunk/src/UdmBase/UdmStatic.cpp
   UDM/trunk/src/UdmDom/UdmDom.cpp
   UDM/trunk/src/UdmUtil/UdmUtil.cpp

Modified: UDM/trunk/include/UdmDom.h
==============================================================================
--- UDM/trunk/include/UdmDom.h	Thu Dec  6 06:58:22 2012	(r4138)
+++ UDM/trunk/include/UdmDom.h	Mon Dec 10 07:20:01 2012	(r4139)
@@ -57,7 +57,7 @@
 typedef std::map<Udm::ObjectImpl::uniqueId_type, DOMElement*> IdToDomElementMap;
 typedef std::pair<const Udm::ObjectImpl::uniqueId_type, DOMElement*> IdToDomElementMapItem;
 
-	
+
 namespace UdmDom
 {
 	using namespace std;
@@ -71,7 +71,7 @@
 	
 	bool isXmi(const string& filename);
 
-	
+
 	class DomDataNetwork : public Udm::DataNetwork 
 	{
 		static bool multiroles;
@@ -89,8 +89,10 @@
 		static UDM_DLL string DTDPath;
 		//meta type-cache-by-name
 		map<string, ::Uml::Class> meta_class_cache;
+
 		//to temporarily store helper associations
-		multimap<long, multimap<long, XMLCh*>> to_assoc_help;
+		typedef multimap<long, XMLCh*> to_assoc_help_mmap;
+		multimap<long, to_assoc_help_mmap> to_assoc_help;
 
 
 		UDM_DLL DomDataNetwork(const Udm::UdmDiagram &metainfo, Udm::UdmProject* pr = NULL);

Modified: UDM/trunk/include/UdmUtil.h
==============================================================================
--- UDM/trunk/include/UdmUtil.h	Thu Dec  6 06:58:22 2012	(r4138)
+++ UDM/trunk/include/UdmUtil.h	Mon Dec 10 07:20:01 2012	(r4139)
@@ -42,7 +42,7 @@
 	};
 	extern UDM_DLL const CopyOpts DefCopyOpts;
 
-	UDM_DLL bool isHelperAssociation(string roleName, bool isAssocClass);
+	UDM_DLL bool isHelperAssociation(Uml::AssociationRole assocRole, Uml::Class cls);
 
 	//utility which copies a subtree from a data network to another
 	//consistent (same) meta is assumed.

Modified: UDM/trunk/src/UdmBase/UdmStatic.cpp
==============================================================================
--- UDM/trunk/src/UdmBase/UdmStatic.cpp	Thu Dec  6 06:58:22 2012	(r4138)
+++ UDM/trunk/src/UdmBase/UdmStatic.cpp	Mon Dec 10 07:20:01 2012	(r4139)
@@ -2008,8 +2008,8 @@
 		
 		//ref port container change 
 		bool isRefPortContChange = false;
-		bool isHelperAssoc = UdmUtil::isHelperAssociation(Uml::MakeRoleName(meta), Uml::IsAssocClass(m_type));
-		
+		bool isHelperAssoc = UdmUtil::isHelperAssociation(meta, m_type);
+
 		bool realConnExists = true;
 		Uml::Association assoc = m_type.association();
 

Modified: UDM/trunk/src/UdmDom/UdmDom.cpp
==============================================================================
--- UDM/trunk/src/UdmDom/UdmDom.cpp	Thu Dec  6 06:58:22 2012	(r4138)
+++ UDM/trunk/src/UdmDom/UdmDom.cpp	Mon Dec 10 07:20:01 2012	(r4139)
@@ -2695,14 +2695,8 @@
 		{
 			
 			//handle ref port container change
-			::Uml::Class m_type = ((ObjectImpl*)this)->type();
-
 			bool isRefPortContChange = false;
-			bool isHelperAssoc = UdmUtil::isHelperAssociation(Uml::MakeRoleName(role), Uml::IsAssocClass(m_type));
-
-			if (isHelperAssoc){
-				long dnid = ((DomDataNetwork*)mydn)->uniqueId();
-			}
+			bool isHelperAssoc = UdmUtil::isHelperAssociation(role, m_type);
 		
 			bool realConnExists = true;
 			Uml::Association assoc = m_type.association();
@@ -2732,18 +2726,18 @@
 
 			if (!isRefPortContChange && direct) {
 
-				pair<multimap<long, multimap<long, XMLCh*>>::const_iterator, multimap<long, multimap<long, XMLCh*>>::const_iterator>  it = ((DomDataNetwork*)mydn)->to_assoc_help.equal_range(uniqueId());
+				pair<multimap<long, DomDataNetwork::to_assoc_help_mmap>::const_iterator, multimap<long, DomDataNetwork::to_assoc_help_mmap>::const_iterator>  it = ((DomDataNetwork*)mydn)->to_assoc_help.equal_range(uniqueId());
 				
-				for (multimap<long, multimap<long, XMLCh*>>::const_iterator j = it.first; j != it.second;)
+				for (multimap<long,  DomDataNetwork::to_assoc_help_mmap>::const_iterator j = it.first; j != it.second;)
 				{
-					multimap<long, XMLCh*> emap = j->second;
-					multimap<long, multimap<long, XMLCh*>>::const_iterator erase_it = j++;
+					DomDataNetwork::to_assoc_help_mmap emap = j->second;
+					multimap<long, DomDataNetwork::to_assoc_help_mmap>::const_iterator erase_it = j++;
 					Uml::AssociationRole ar = role.rp_helper();
 					long count = emap.count(ar.uniqueId());	
 					if (count)
 					{
 						if (count > 1) throw udm_exception("More than one reference assigned to association role: "+(string)ar.name());
-						pair<multimap<long, XMLCh*>::const_iterator, multimap<long, XMLCh*>::const_iterator>  it1 = emap.equal_range(ar.uniqueId());
+						pair<DomDataNetwork::to_assoc_help_mmap::const_iterator, DomDataNetwork::to_assoc_help_mmap::const_iterator>  it1 = emap.equal_range(ar.uniqueId());
 						
 						vector<ObjectImpl*> v;
 						XMLCh* oid = (*it1.first).second;
@@ -2877,7 +2871,7 @@
 					} else {
 						if(nvect.size() == 1){
 							pair<long, XMLCh*> p = make_pair(orole.uniqueId(), XMLString::replicate(myid));
-							multimap<long, XMLCh*> mmap;
+							DomDataNetwork::to_assoc_help_mmap mmap;
 							mmap.insert(p);
 							((DomDataNetwork*)mydn)->to_assoc_help.insert(make_pair(peer.uniqueId(), mmap));
 						}
@@ -2897,14 +2891,13 @@
 				if(isRefPortContChange){
 					//save current to tmp map
 					pair<long, XMLCh*> p = make_pair(role.uniqueId(), XMLString::replicate(aa));
-					multimap<long, XMLCh*> mmap;
+					DomDataNetwork::to_assoc_help_mmap mmap;
 					mmap.insert(p);
 					((DomDataNetwork*)mydn)->to_assoc_help.insert(make_pair(uniqueId(), mmap));
 				}else{
 					dom_element->setAttribute(tname_buf, aa);
-					XMLString::release(&aa);
 				}
-
+				XMLString::release(&aa);
 			}
 
 			{

Modified: UDM/trunk/src/UdmUtil/UdmUtil.cpp
==============================================================================
--- UDM/trunk/src/UdmUtil/UdmUtil.cpp	Thu Dec  6 06:58:22 2012	(r4138)
+++ UDM/trunk/src/UdmUtil/UdmUtil.cpp	Mon Dec 10 07:20:01 2012	(r4139)
@@ -280,9 +280,9 @@
 		}
 
 	}
-	bool isHelperAssociation(string roleName, bool isAssocClass)
+	bool isHelperAssociation(Uml::AssociationRole assocRole, Uml::Class cls)
 	{
-		return (!isAssocClass ? roleName.find("_rp_container_rev") != string::npos : roleName.find("_rp_container") != string::npos);
+		return (Uml::AssociationRole)theOther(assocRole).rp_helper_user() != Udm::null || (Uml::IsAssocClass(cls) && (Uml::AssociationRole)assocRole.rp_helper_user()!= Udm::null);
 	}
 	
 	int reqCopyObjectHierarchy(ObjectImpl* p_srcRoot, ObjectImpl* p_dstRoot, DataNetwork* p_dstBackend,  bool & finished, copy_assoc_map &cam)


More information about the Mobies-commit mailing list