Inline singleton unmarshalling, and throw an error if multiple copies show up.
authorcantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Fri, 14 Dec 2007 17:31:20 +0000 (17:31 +0000)
committercantor <cantor@de75baf8-a10c-0410-a50a-987c0e22f00f>
Fri, 14 Dec 2007 17:31:20 +0000 (17:31 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@449 de75baf8-a10c-0410-a50a-987c0e22f00f

xmltooling/base.h

index 31e9edf..76fdc50 100644 (file)
 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \
     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
         proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
-        if (typesafe) { \
-            set##proper(typesafe); \
+        if (typesafe && !m_##proper) { \
+            typesafe->setParent(this); \
+            *m_pos_##proper = m_##proper = typesafe; \
             return; \
         } \
     }
 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
         ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
-        if (typesafe) { \
-            set##proper(typesafe); \
+        if (typesafe && !m_##proper) { \
+            typesafe->setParent(this); \
+            *m_pos_##proper = m_##proper = typesafe; \
             return; \
         } \
     }
  */
 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
     if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
-        set##proper(childXMLObject); \
-        return; \
+        if (!m_##proper) { \
+            childXMLObject->setParent(this); \
+            *m_pos_##proper = m_##proper = childXMLObject; \
+            return; \
+        } \
     }
 
 /**