[Mobies-commit] [commit] r3871 - in UDM/trunk: include src/UdmBase src/UdmDom
ksmyth at redhat1.isis.vanderbilt.edu
ksmyth at redhat1.isis.vanderbilt.edu
Mon Aug 29 14:32:50 CDT 2011
Author: ksmyth
Date: Mon Aug 29 14:32:50 2011
New Revision: 3871
Log:
Make uniqueId_type == size_t on Windows AMD64
Modified:
UDM/trunk/include/UdmBase.h
UDM/trunk/include/UdmDom.h
UDM/trunk/src/UdmBase/UdmStatic.cpp
UDM/trunk/src/UdmBase/UmlExt.cpp
UDM/trunk/src/UdmDom/UdmDom.cpp
Modified: UDM/trunk/include/UdmBase.h
==============================================================================
--- UDM/trunk/include/UdmBase.h Sat Aug 27 11:53:58 2011 (r3870)
+++ UDM/trunk/include/UdmBase.h Mon Aug 29 14:32:50 2011 (r3871)
@@ -308,7 +308,11 @@
public:
// every object in one project must return a unique uniqueId
+#if defined(_WIN32) && defined(_M_AMD64)
+ typedef size_t uniqueId_type;
+#else
typedef long uniqueId_type;
+#endif
virtual uniqueId_type uniqueId() const = 0;
@@ -3259,7 +3263,7 @@
virtual void resetStaticUdmProject() { if (!(pr && _static_pr)) throw("Datanetwork is either not part of a project or is part of a non-static project!"); pr = NULL; };
virtual Object ObjectById(Object::uniqueId_type) {
- throw udm_exception("This backend does not support ObjectByID!!");
+ throw udm_exception("This backend does not support ObjectByID");
}
const ::Uml::Diagram &GetRootMeta() const {
return *metaroot.dgr;
Modified: UDM/trunk/include/UdmDom.h
==============================================================================
--- UDM/trunk/include/UdmDom.h Sat Aug 27 11:53:58 2011 (r3870)
+++ UDM/trunk/include/UdmDom.h Mon Aug 29 14:32:50 2011 (r3871)
@@ -54,8 +54,8 @@
XERCES_CPP_NAMESPACE_END
XERCES_CPP_NAMESPACE_USE
-typedef std::map<unsigned long, DOMElement*> IdToDomElementMap;
-typedef std::pair<const unsigned long, DOMElement*> IdToDomElementMapItem;
+typedef std::map<Udm::ObjectImpl::uniqueId_type, DOMElement*> IdToDomElementMap;
+typedef std::pair<const Udm::ObjectImpl::uniqueId_type, DOMElement*> IdToDomElementMapItem;
namespace UdmDom
@@ -141,7 +141,7 @@
//map of Elements in the Diagram
IdToDomElementMap DomElements;
- void DoMapping(DOMElement *const e, long id, bool force);
+ void DoMapping(DOMElement *const e, Udm::ObjectImpl::uniqueId_type id, bool force);
DOMElement* Search(const XMLCh *str);
//get the string if datanetwork is str_based
Modified: UDM/trunk/src/UdmBase/UdmStatic.cpp
==============================================================================
--- UDM/trunk/src/UdmBase/UdmStatic.cpp Sat Aug 27 11:53:58 2011 (r3870)
+++ UDM/trunk/src/UdmBase/UdmStatic.cpp Mon Aug 29 14:32:50 2011 (r3871)
@@ -3469,13 +3469,16 @@
unsigned long StaticObject::Serialize(FILE *f)
{
+#if defined(_WIN32) && defined(_M_AMD64)
+ // FIXME: add map<uniqueId_type, unsigned long> id_map;
+#endif
//this will return the length in bytes of space
//and write this object to file
unsigned long length = 0;
- //write mY uniqueID to file
+ //write my uniqueId to file
unsigned long my_id = uniqueId();
fwrite(&my_id, sizeof(unsigned long), 1, f);
length += sizeof(unsigned long);
Modified: UDM/trunk/src/UdmBase/UmlExt.cpp
==============================================================================
--- UDM/trunk/src/UdmBase/UmlExt.cpp Sat Aug 27 11:53:58 2011 (r3870)
+++ UDM/trunk/src/UdmBase/UmlExt.cpp Mon Aug 29 14:32:50 2011 (r3871)
@@ -669,8 +669,10 @@
name = auxname;
}
else {
- char buf[12];
-#ifdef _WIN32
+ char buf[25];
+#if defined(_WIN32) && defined(_M_AMD64)
+ sprintf_s(buf, "%Ix", r.__impl()->uniqueId());
+#elif defined(_WIN32)
_ultoa(r.__impl()->uniqueId(),buf,10);
#else
snprintf(buf, 11, "%ld", r.__impl()->uniqueId());
Modified: UDM/trunk/src/UdmDom/UdmDom.cpp
==============================================================================
--- UDM/trunk/src/UdmDom/UdmDom.cpp Sat Aug 27 11:53:58 2011 (r3870)
+++ UDM/trunk/src/UdmDom/UdmDom.cpp Mon Aug 29 14:32:50 2011 (r3871)
@@ -824,18 +824,22 @@
{
//static unsigned long idcount = time(NULL);
- static unsigned long id;
+ uniqueId_type id;
const XMLCh *a = dom_element->getAttribute(gXML__id);
if(EmptyVal(a))
{
- XMLCh buf[21] = { chLatin_i, chLatin_d, chNull };
+ XMLCh buf[25] = { chLatin_i, chLatin_d, chNull };
//we have a unique id for ordering
//so why maintain two of them ?
id = uniqueId();
//build the string attribute
- //begins with 'id'
+ //begins with 'id'
+#if defined(_WIN32) && defined(_M_AMD64)
+ swprintf_s(buf, L"id%Ix", id);
+#else
XMLString::binToText(id, buf + 2, 18, 16);
+#endif
//assign it
dom_element->setAttribute(gXML__id, buf);
@@ -883,13 +887,17 @@
//this is part of the project
//we will record every id in the backend
- static unsigned long id;
+ Udm::ObjectImpl::uniqueId_type id;
const XMLCh *a = dom_element->getAttribute(gXML__id);
if(EmptyVal(a))
{
- XMLCh buf[21] = { chLatin_i, chLatin_d, chNull };
+ XMLCh buf[25] = { chLatin_i, chLatin_d, chNull };
id = reinterpret_cast<uniqueId_type>(p);
+#if defined(_WIN32) && defined(_M_AMD64)
+ swprintf_s(buf, L"id%Ix", id);
+#else
XMLString::binToText(id, buf + 2, 18, 16);
+#endif
dom_element->setAttribute(gXML__id, buf);
SET_ID_ATTR(dom_element, gXML__id);
}
@@ -1816,7 +1824,7 @@
//in the map there *might* be a mapping from unique id to dom_element
//we remove it, if there is
//also note that it's not a must
- unsigned long id = uniqueId();
+ uniqueId_type id = uniqueId();
//Minor bugfix here
//element should be removed after removing from the mapping.
//since __getdn() calls need the DOM tree to be consistent
@@ -3562,7 +3570,7 @@
}
- void DomDataNetwork::DoMapping(DOMElement *const e, long id, bool force)
+ void DomDataNetwork::DoMapping(DOMElement *const e, DomObject::uniqueId_type id, bool force)
{
IdToDomElementMapItem item_to_store(id, e);
pair<IdToDomElementMap::iterator, bool> ins_res;
More information about the Mobies-commit
mailing list