Those of you who use ObjAsm32 may be familiar with the DataCollection object.. its a Collection that stores a list of pointers to 'Data objects' (HeapMem objects) which are each allocated by the User and thus are each arbitrary in size.
Being able to maintain a collection of arbitrary memory chunks is sure useful, but it'd be even nicer if we could Load and Save the entire collection, wouldn't it?

Attached is an update for the DataCollection object which redefines the ancestor Load and Save methods to handle Data objects.
Note the inclusion of two new macros, MemSize and $MemSize.. these fetch the size of MemAlloc'd objects ;)

What do you think, Biterider?
Posted on 2007-02-22 00:45:44 by Homer
Hi Homer
I have prepared something similar for the next release.
The 2 new redefined methods are intended for universal use, letting room for optimization if the data chunks are all of the same size.



PS: have you still problems with the messenger?
Posted on 2007-02-22 00:58:02 by Biterider
You beat me to it again - and your version is superior :)
Yes still problems with messenger - but not with account / login.
I'm having trouble getting connected / staying connected after the login completes. Some days are better than others.

Have you also a SortedDataCollection?
I was just about to duplicate my Load/Save code into SDC when I noticed that you'd replied...
(Yeah, I know, the KeyOf method desperately needs to be overridden by the User for ANY specific implementation... seems like a job for a UserCallback rather than forcing the User to derive their own classes..)
Posted on 2007-02-22 01:34:59 by Homer
Hi Homer
I have not modified the SortedDataCollection yet, but it seems that it is necessary for completeness.
About the KeyOf method, it is a dynamic method. This has the advantage that it is not necessary to derive a new class if you want a specific behaviour. The idea is to redefine this method at runtime.


Posted on 2007-02-22 02:53:03 by Biterider