st2599
asked on
Serialization
How can I serialize the mixed implementation data structure of Graph? Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I suggest you post further info about your particular case if the more general answer/comments are not detailed enough.
I suggest you post further info about your particular case if the more general answer/comments are not detailed enough.
CMyDoc::Serialize(CArchive
{
CGraph::Serialize(ar)
// ... continue with normal serialize-stuff
}
CGraph::Serialize(CArchive
{
if (ar.IsStoring())
{
ar << m_amountOfObjects;
for( int i=0 ; i< m_amountOfObjects ; i++ )
{
CMyObject *pObject = GetMyObject(i);
pObject->Serialize(ar);
}
}
else
{
ar >> m_amountOfObjects;
for( int i=0 ; i< m_amountOfObjects ; i++ )
{
CMyObject *pObject = new CMyObject();
pObject->Serialize(ar);
AddMyObject(pObject);
}
}
}
CMyObject::Serialize() ...