[Mobies-commit] [commit] r3910 - UDM/trunk/src/UdmGme

ksmyth at redhat1.isis.vanderbilt.edu ksmyth at redhat1.isis.vanderbilt.edu
Tue Oct 4 18:14:11 CDT 2011


Author: ksmyth
Date: Tue Oct  4 18:14:11 2011
New Revision: 3910

Log:
getPath2 performance optimization

Modified:
   UDM/trunk/src/UdmGme/MgaDefs.h

Modified: UDM/trunk/src/UdmGme/MgaDefs.h
==============================================================================
--- UDM/trunk/src/UdmGme/MgaDefs.h	Tue Oct  4 18:14:01 2011	(r3909)
+++ UDM/trunk/src/UdmGme/MgaDefs.h	Tue Oct  4 18:14:11 2011	(r3910)
@@ -53,6 +53,35 @@
 #define objself (folderself? (IMgaObject *) folderself : (IMgaObject *)self)
 #define testself (self ? self : (throw udm_exception("Invalid method on folders"), NULL))
 #define NAMEGET(x) (((string)((x).name())).c_str())
-#define PATHGET(x) (((x).getPath2("::", false)).c_str())
+
+
+static string getClassPath(const Uml::Class& c)
+{
+	if (!c)
+		return "";
+	std::string ret;
+	Udm::Object o = c;
+	while (o.GetParent())
+	{
+		const Uml::Class& type = o.type();
+		if (type == Uml::Class::meta)
+		{
+			ret = static_cast<std::string>(Uml::Class::Cast(o).name()) + ret;
+		} 
+		else if (type == Uml::Namespace::meta)
+		{
+			ret = static_cast<std::string>(Uml::Namespace::Cast(o).name()) + std::string("::") + ret;
+		} 
+		else if (type == Uml::Diagram::meta)
+		{
+			ret = static_cast<std::string>(Uml::Diagram::Cast(o).name()) + std::string("::") + ret;
+		} 
+		o = o.GetParent();
+	}
+	// ASSERT(ret == c.getPath2("::", false));
+    return ret;
+}
+
+#define PATHGET(x) (getClassPath(x).c_str())
 #define foldiffold (folderself ? folderself : self)
 #endif
\ No newline at end of file


More information about the Mobies-commit mailing list