Hello everyone,
I am trying to read in a list structure which is serialized as
m_DataPointerList.Serialize( ar );
where m_DataPointerList is defined as :
CTypedPtrList<CObList,CDataPointer*> m_DataPointerList;
and class CDataPointer is declared as:
class CDataPointer : public CObject
{
public:
CDataPointer();
protected:
DECLARE_SERIAL(CDataPointer)
protected:
public:
unsigned long Time; unsigned char Channel;
unsigned char Rate;
public:
virtual void Serialize(CArchive& ar);
};
and defined as:
IMPLEMENT_SERIAL(CDataPointer, CObject, 1)
CDataPointer::CDataPointer()
{
}
void CDataPointer::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
ar << Time;
ar << Channel;
ar << Rate;
}
else
{
ar >> Time;
ar >> Channel;
ar >> Rate;
}
}
I am having some difficulties( i donno why?) in reading it in using the same serializing command ie:
m_DataPointerList.Serialize( ar );
is there any thing i am overlooking while i am doing this??
on the other hand,
I try to read this using a 'for' loop
which iterates for the number of occurances of CDataPointer. but i have to add an offset at the end of every iteration if I were to read the next iteration correctly.
something like
nDataCounter=ar.ReadCount();
for(i=0;i < nDataCounter;i++)
{
ar>>Time;
ar>>Channel;
ar>>Rate;
ar.Flush();
pFile->Seek(offSET, CFile::current);
}
i dont understand why i have to provide this offset.and i have trouble choosing the correct offSET as it varies for different lists. again is there something i am doing wrong ?
Can please you give me some insight into these two issues??
Thanks a lot
I am trying to read in a list structure which is serialized as
m_DataPointerList.Serialize( ar );
where m_DataPointerList is defined as :
CTypedPtrList<CObList,CDataPointer*> m_DataPointerList;
and class CDataPointer is declared as:
class CDataPointer : public CObject
{
public:
CDataPointer();
protected:
DECLARE_SERIAL(CDataPointer)
protected:
public:
unsigned long Time; unsigned char Channel;
unsigned char Rate;
public:
virtual void Serialize(CArchive& ar);
};
and defined as:
IMPLEMENT_SERIAL(CDataPointer, CObject, 1)
CDataPointer::CDataPointer()
{
}
void CDataPointer::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
ar << Time;
ar << Channel;
ar << Rate;
}
else
{
ar >> Time;
ar >> Channel;
ar >> Rate;
}
}
I am having some difficulties( i donno why?) in reading it in using the same serializing command ie:
m_DataPointerList.Serialize( ar );
is there any thing i am overlooking while i am doing this??
on the other hand,
I try to read this using a 'for' loop
which iterates for the number of occurances of CDataPointer. but i have to add an offset at the end of every iteration if I were to read the next iteration correctly.
something like
nDataCounter=ar.ReadCount();
for(i=0;i < nDataCounter;i++)
{
ar>>Time;
ar>>Channel;
ar>>Rate;
ar.Flush();
pFile->Seek(offSET, CFile::current);
}
i dont understand why i have to provide this offset.and i have trouble choosing the correct offSET as it varies for different lists. again is there something i am doing wrong ?
Can please you give me some insight into these two issues??
Thanks a lot