ecere/containers/Array: Implemented faster deserialization
[sdk] / ecere / src / com / containers / Array.ec
index f1f9b63..87eca14 100644 (file)
@@ -2,6 +2,10 @@ namespace com;
 
 import "Container"
 
+default:
+extern int __ecereVMethodID_class_OnUnserialize;
+private:
+
 public class Array : Container
 {
    class_fixed
@@ -16,6 +20,22 @@ public:
       delete array;
    }
 
+   void OnUnserialize(IOChannel channel)
+   {
+      Array array = eInstance_New(_class.fullName);
+      uint count, c;
+      Class Dclass = class(D);
+      channel.Get(count);
+      //printf("%d %ss\n", count, Dclass.name);
+      if(count > 10000)
+         printf("Bug");
+      array.size = count;
+      for(c = 0; c < count; c++)
+         ((void (*)(void *, void *, void *))(void *)Dclass._vTbl[__ecereVMethodID_class_OnUnserialize])
+            (Dclass, ((byte *)array.array) + Dclass.typeSize * c, channel);
+      this = array;
+   }
+
    // Generic iterator support
    IteratorPointer GetFirst() { return (IteratorPointer)array; }
    IteratorPointer GetLast() { return (IteratorPointer)(array ? (array + (count - 1)) : null); }