BaH.Persistence & array of arrays

BlitzMax Forums/Brucey's Modules/BaH.Persistence & array of arrays

Oddball(Posted 2010) [#1]
The persistence mod does not seem to be able to deserialise an array of arrays if any of the arrays are referenced by multiple indices. i.e. all the arrays have to be separate copies. An example might help explain it better.

This does not work:


However this does work:


The first example only throws an error, but I have a more complex program which actually crashes my Mac because of this. I can make it work by copying all the arrays instead of referencing them, but that's not an ideal solution.


Oddball(Posted 2010) [#2]
I have been working around this issue, but it's becoming a deal breaker for me. Does anyone know if there is a solution to this? Is it possibly related to this issue? If so what was the fix?

It's a major issue as it doesn't throw up any Max error, but actually crashes my Mac. Tried looking at the source, but I'm no Brucey and don't know what I'm looking for. I'm stumped.


Tommo(Posted 2010) [#3]
http://indie-g-games.googlecode.com/files/tommo.mod.zip
Here's my persistence module which might be usable for you.
It serializes object into binary stream, so the file is smaller and the deserialization is faster than xml.
But it dosen't support multiple-dimension array, and not very much tested.
The usage is simple:
persistObject(obj:Object, url:Object)
unpersistObject:Object(url:Object)

Just do whatever you want with it. :)


Oddball(Posted 2010) [#4]
Thanks Tommo, but unfortunately I'm use multidimensional arrays and array of arrays, I'll still take a look though. The objects I'm serialising are quite complex, and for the most part Brucey's mod does the trick very nicely. The compressed serialised files are very small and I've had no issues with speed. It's just this one stumbling block.


Tommo(Posted 2010) [#5]
http://indie-g-games.googlecode.com/files/persistence.mod.zip
Now it supports multiple dimension arrays...


Oddball(Posted 2011) [#6]
Bumping this as Brucey is posting again. It seems to be an issue when any array is referenced more than once, and not specific to an array of arrays.


Brucey(Posted 2011) [#7]
Apologies for the slight (*ahem*) delay...

Should he working now.


Oddball(Posted 2011) [#8]
Thank you. Works perfectly.