Serialization

General help with the Ecere Cross Platform GUI toolkit: Window, common controls, events, etc.
Help with the 2D Graphics library: Surface, Display, Bitmap, Font and others.
Post Reply
samsam598
Posts: 212
Joined: Thu Apr 14, 2011 9:44 pm

Serialization

Post by samsam598 »

In sample openrider it seems serialization and unserialization have been used.Am I correct?I want to learn more on the topic in eC.Any more informations and guidance would be appreicated.
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Serialization

Post by jerome »

Hi Sam,

Yes I recently fixed some bugs relating to how these methods work, especially with the normal 'class' objects.

OnSerialize / OnUnserialize are part of the methods every type has.

There is also a default implementation for all types.

You can serialize / unserialize from an IOChannel class (File also inherits from IOChannel).

So you can do File f = FileOpen("someFile", write); f.Put(myObject) to serialize and f.Get(myObject) to deserialize.

Then you can override the default behavior if you want to control how a particular class is to be serialized/deserialized.

(De)Serialization is also used in EDA to store to or retrieve from a database types the database doesn't natively supports (blobs), and for network communication (e.g. distributed objects: remote class).

That's the basics! Let me know if you have any further questions.

Regards,

Jerome
Post Reply