nixnixnix Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
Senior Member
I retract my former comments
Nick
p.s. this is my attempt to setup a framework in which I can see the size of objects before I read them or alternatively just read past them.
int OCOE::GetSize()
{
SizeStream s;
Serialize1(s);
int bytes = s.GetSize();
return bytes;
}
void OCOE::Serialize(Stream& s)
{
int n;
if(s.IsStoring())
{
n = GetSize(); // i.e. this is a variable sized object
}
s % n;
Serialize1(s);
}
void OCOE::Serialize1(Stream& s)
{
int version = VERSION_MAJOR*100000000 + VERSION_MINOR*1000000 /*+ VERSION_VAR*10000*/ + VERSION_COMMIT;
int n = version;
s % n; // so you can check it and do logic on it
String sType = "OCOE";
s % sType;
s % m_fRoadBase;
s % m_fRoadExtant;
s % m_fRoadMaxGrad;
s % m_fRoadMinRadius;
s % m_fRoadX;
...
I don't think the SizeStream::GetSize() function does what I hoped it does though so I need to keep looking for an easily maintainable solution...