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 » About Serialization
About Serialization [message #50455] Thu, 01 November 2018 11:41 Go to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi Mirek,

A quick question here: Is Serialization guaranteed to retain binary compatibility over the years to come and across platforms? I.e. is it safe to store data in files created by Serialize() so that they can be read from those same files in the coming years with programs created with future versions of U++?

Best regards,

Tom
Re: About Serialization [message #50457 is a reply to message #50455] Fri, 02 November 2018 09:08 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Thu, 01 November 2018 11:41
Hi Mirek,

A quick question here: Is Serialization guaranteed to retain binary compatibility over the years to come and across platforms? I.e. is it safe to store data in files created by Serialize() so that they can be read from those same files in the coming years with programs created with future versions of U++?

Best regards,

Tom


Well, this one is interesting... Originally, it was not meant to be (like 15 years ago...), but now it definitely is. As long as you play right with Serialize (e.g. carefully version for the future), it is compatible across platforms and future proof.

Mirek

[Updated on: Fri, 02 November 2018 09:08]

Report message to a moderator

Re: About Serialization [message #50458 is a reply to message #50457] Fri, 02 November 2018 10:32 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Thanks Mirek!

Sounds promising. Is the following the correct and complete documentation to follow?

https://www.ultimatepp.org/srcdoc$Core$Tutorial$en-us.html#S ection_2_3

Best regards,

Tom


Re: About Serialization [message #50460 is a reply to message #50458] Fri, 02 November 2018 14:59 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, that is rather tutorial than docs, but yes, it gives the general idea.
Re: About Serialization [message #50767 is a reply to message #50460] Fri, 14 December 2018 11:34 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi Mirek,

I would like to serialize 'Vector<Any> vec;', but Any does not have Serialize() available. How to proceed to accomplish this?

Best regards,

Tom
Re: About Serialization [message #50768 is a reply to message #50767] Fri, 14 December 2018 12:58 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Fri, 14 December 2018 11:34
Hi Mirek,

I would like to serialize 'Vector<Any> vec;', but Any does not have Serialize() available. How to proceed to accomplish this?

Best regards,

Tom


That is basically impossible for really generic case...

If the set of classes stored in Any is fixed, you can do that testing this fixed set of types, encoding the type when being stored and storing using types's Serialize, then on loading creating proper class based on encoded type and again Serialize it back.

Mirek
Re: About Serialization [message #50769 is a reply to message #50768] Fri, 14 December 2018 13:53 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

This is exactly what I just did as a workaround while waiting for your input on the subject. (I thought there might be a nicer way.) Anyway, it works just fine!

Thanks and best regards,

Tom
Re: About Serialization [message #50770 is a reply to message #50769] Fri, 14 December 2018 13:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Fri, 14 December 2018 13:53
Hi,

This is exactly what I just did as a workaround while waiting for your input on the subject. (I thought there might be a nicer way.) Anyway, it works just fine!

Thanks and best regards,

Tom


P.S.: Maybe you could rather put that data in Value? Value has full interfaces that allow to serialize any custom Value types..
Re: About Serialization [message #50771 is a reply to message #50770] Fri, 14 December 2018 14:04 Go to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
That sounds interesting.. I need to dig a little deeper with that idea!

While Any has worked great for my mixed set of classes, it is a bit complex to code with those Is<>() / Get<>() interfaces. Value with my own classes might be a nicer way to deal with this.

Thanks,

Tom
Previous Topic: AssertST problem in initialization when debugging on MSBT17x64
Next Topic: GetCsvLine
Goto Forum:
  


Current Time: Thu Mar 28 12:52:03 CET 2024

Total time taken to generate the page: 0.01845 seconds