Example 1
The marshal_PMARSH function
// marshal a marshallable object void marshal_PMARSH(XMLDoc* pDoc, XMLElement* pDocElem, const ElementDesc*, void* pdata, void* pother, int aspect) { // pdata points to variable with pointer to Marshallable type if(0 == pDocElem) pDocElem = pDoc->getDocumentElement(); Marshallable *pMarsh = *(Marshallable**)pdata; Marshallable *pOtherMarsh = (pother != 0) ? *(Marshallable**)pother : 0; XMLElement* pElem = pDocElem->appendElement("_RegisteredType_", 16); const char* type_name = pMarsh->GetTypeName(aspect); pElem->setAttribute("name", 4, type_name, strlen(type_name)); pMarsh->Marshal(pDoc, pElem, pother, aspect); delete pElem; }