[DGD]serialisation/deserialisation of mixed data.

balduin at uni-paderborn.de balduin at uni-paderborn.de
Mon Apr 26 14:18:57 CEST 1999


Hello !

I currently have the Problem, that I want to serialize and
deserialize Data of type mixed. This is easy as long as I 
use basic dgd types. (int, string, float, array, mapping)
When dealing with objects I stumble into problems. As I have
persistent objects in a mysql database (If there is interest
in the dgd-patches for this contact me), each object has
it's uniqe ID. The straight forward idea with serialisation
is to use this ID and mark it with a special character lets
say #42 to indicate persistent database object 42. This works
fine in both directions as long as we don't have recursive
Datastructures e.g. complex inventory structures. As I have
a hierarchic room structure (rooms containing rooms in their
inventory) loading the root room, would imply loading the
complete mud at once. To avoid this I decided to postpone
loading the true object until a function is called, and want 
to store a marker denoting the Object Number. I currently
use an array ({ int ObID, object Ob }), and patched call_other
to call the second (if exists) or fetch it from the 
(mysql database) otherwise and execute afterwards. (ugly I know)
With this serialisation becomes a problem. Since the complete
array denotes the object. My only idea is to use very ugly
heuristics to serialize ({ 42, ob-pointer }) to #42. My question
is: does anybody out there have some smart ideas, how to make
this type-save ? I think this is the very first situation I 
really miss typedef and struct in dgd.

btw. I don't want to write a wrapper object since this would
be to expensive concerning memory. 

Ludger Merkens
balduin at uni-paderborn.de

Ah yes, if you have suggestions how to address the complete
Problem without such ugly hacks with call_other, your ideas 
are welcome.

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list