ok i'll try to explain better...
i have an object class
class CSpLine : public CObject
{
DECLARE_SERIAL(CSpLine)
public:
void AFXAPI SerializeElements(CArchive &ar,POINT*,int nCount);
CSpLine();
void Serialize(CArchive &ar);
void Draw(HDC& hDC);
CArray <POINT,POINT> m_ControlPoints;
CArray <POINT,POINT> m_CurvePoints;
CSpLine::CSpLine(CArray<POINT,POINT>&ControlPoints,CArray<POINT,POINT>&CurvePoints);
virtual ~CSpLine();
};
class SpLine is for handling graphic SpLine so it has ControlPoints(the node of curve) and real CurvePoints represented by 2 CArray objects of types POINT.
In my CView derived class handles MouseMove message:
void MyView::OnMouseMove(UINT nFlags, CPoint point)
{
pDoc->m_ControlPoints[m_MoveIndex] = point;
if (pDoc->m_ControlPoints.GetSize()>1)
{
Spline spline(pDoc->m_ControlPoints.GetData(),pDoc->m_ControlPoints.GetSize());
spline.Generate();
pDoc->m_CurvePoints.SetSize(spline.GetCurveCount());
int PointCount = 0;
spline.GetCurve(pDoc->m_CurvePoints.GetData(),PointCount);
}
CDC* pDC = GetDC();
OnDraw(pDC);
ReleaseDC(pDC);
CSpLine* pSpLine = pDoc->AddSpLine();
pSpLine->Draw(pDC->m_hDC);
calls AddSpLine function that add to CObArray
CSpLine* MyDocument::AddSpLine()
{
CSpLine* pSpLine = new CSpLine(m_ControlPoints,m_CurvePoints);
m_oaSpLines.Add(pSpLine);
return pSpLine;
}
where m_oaSpLines is a CObArray.
i call serialize in document class for m_oaSpLine
void mydocument::Serialize(CArchive& ar)
{
m_oaSpLines.Serialize(ar);
}
so we recall serialize in SpLine class and i don't know how to implement serialization here,i can't use << >> operators so if i write
void CSpLine::Serialize(CArchive &ar)
{
m_ControlPoints.Serialize(ar);
m_CurvePoints.Serialize(ar);
/* i can't write
if (ar.IsStoring)
ar << m_ControlPoints <<m_CurvePoints;
else
ar >> m_ControlPoints >>m_CurvePoints;
*/
}
there's no compiler error but there's no serialization and i lost data...
i hope it's quite clear...