Ecere SDK/eC Forums
http://ec-lang.org/community/
Print view

Serialization
http://ec-lang.org/community/viewtopic.php?f=5&t=376
Page 1 of 1
Author:  samsam598 [ Wed Oct 02, 2013 6:33 am ]
Post subject:  Serialization

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.
Author:  jerome [ Wed Oct 02, 2013 1:19 pm ]
Post subject:  Re: Serialization

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
All times are UTC-05:00 Page 1 of 1