Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » (Possible) Serialization issue
Re: (Possible) Serialization issue [message #17404 is a reply to message #17235] Wed, 13 August 2008 21:11 Go to previous messageGo to previous message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
I retract my former comments Smile Embarassed

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...

[Updated on: Wed, 13 August 2008 21:48]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Core/Ol_Set.cpp should to change!
Next Topic: [solved!] XML serialization and relative paths
Goto Forum:
  


Current Time: Sat May 11 08:50:30 CEST 2024

Total time taken to generate the page: 0.01847 seconds