Markos Zaharioudakis has proposed merging 
lp:~zorba-coders/zorba/no-expr-serialization into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)
Related bugs:
  Bug #1014975 in Zorba: "Reworked Plan serializer"
  https://bugs.launchpad.net/zorba/+bug/1014975

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/no-expr-serialization/+merge/111622

added serialize_csize function
-- 
https://code.launchpad.net/~zorba-coders/zorba/no-expr-serialization/+merge/111622
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/zorbaserialization/serialize_basic_types.cpp'
--- src/zorbaserialization/serialize_basic_types.cpp	2012-06-19 12:04:29 +0000
+++ src/zorbaserialization/serialize_basic_types.cpp	2012-06-22 15:24:24 +0000
@@ -153,6 +153,28 @@
 /*******************************************************************************
 
 ********************************************************************************/
+void serialize_csize(Archiver& ar, csize& obj)
+{
+  assert(sizeof(csize) <= 8);
+
+  if (ar.is_serializing_out())
+  {
+    uint64_t uint64v = obj;
+    ar.add_simple_temp_field(TYPE_UINT64, &uint64v);
+  }
+  else
+  {
+    uint64_t uint64v;
+    ar.read_next_simple_temp_field(TYPE_UINT64, &uint64v);
+
+    obj = static_cast<csize>(uint64v);
+  }
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
 void operator&(Archiver& ar, int32_t& obj)
 {
   if (ar.is_serializing_out())

=== modified file 'src/zorbaserialization/serialize_basic_types.h'
--- src/zorbaserialization/serialize_basic_types.h	2012-06-19 12:04:29 +0000
+++ src/zorbaserialization/serialize_basic_types.h	2012-06-22 15:24:24 +0000
@@ -23,6 +23,7 @@
 
 #include "zorbamisc/config/platform.h"
 
+#include "store/api/shared_types.h"
 
 
 class MAPM;
@@ -50,6 +51,8 @@
 
 void serialize_ulong(Archiver& ar, ulong& obj);
 
+void serialize_csize(Archiver& ar, csize& obj);
+
 void operator&(Archiver& ar, int32_t& obj);
 
 void operator&(Archiver& ar, uint32_t& obj);

=== modified file 'src/zorbaserialization/serialize_template_types.h'
--- src/zorbaserialization/serialize_template_types.h	2012-05-25 13:57:00 +0000
+++ src/zorbaserialization/serialize_template_types.h	2012-06-22 15:24:24 +0000
@@ -304,7 +304,7 @@
   if (ar.is_serializing_out())
   {
     csize size = obj.size();
-    ar & size;
+    serialize_csize(ar, size);
 
     typename checked_vector<T>::iterator it = obj.begin();
     typename checked_vector<T>::iterator end = obj.end();
@@ -316,7 +316,7 @@
   else
   {
     csize size;
-    ar & size;
+    serialize_csize(ar, size);
 
     obj.resize(size);
 
@@ -340,7 +340,7 @@
   if (ar.is_serializing_out())
   {
     csize size = obj.size();
-    ar & size;
+    serialize_csize(ar, size);
 
     typename std::vector<T>::iterator it = obj.begin();
     typename std::vector<T>::iterator end = obj.end();
@@ -352,7 +352,7 @@
   else
   {
     csize size;
-    ar & size;
+    serialize_csize(ar, size);
 
     obj.resize(size);
 
@@ -375,7 +375,7 @@
   if (ar.is_serializing_out())
   {
     csize size = obj.size();
-    ar & size;
+    serialize_csize(ar, size);
 
     typename std::vector<T*>::iterator it = obj.begin();
     typename std::vector<T*>::iterator end = obj.end();
@@ -387,7 +387,7 @@
   else
   {
     csize size;
-    ar & size;
+    serialize_csize(ar, size);
 
     obj.resize(size);
 
@@ -425,7 +425,7 @@
     (void)is_ref;
 
     size = obj->size();
-    ar & size;
+    serialize_csize(ar, size);
 
     typename std::vector<T>::iterator it = obj->begin();
     typename std::vector<T>::iterator end = obj->end();
@@ -458,7 +458,7 @@
 
     obj = new std::vector<T>;
 
-    ar & size;
+    serialize_csize(ar, size);
 
     obj->resize(size);
 
@@ -483,7 +483,7 @@
   if (ar.is_serializing_out())
   {
     csize size = obj.size();
-    ar & size;
+    serialize_csize(ar, size);
 
     typename std::list<T>::iterator it = obj.begin();
     typename std::list<T>::iterator end = obj.end();
@@ -495,7 +495,8 @@
   else
   {
     csize size;
-    ar & size;
+    serialize_csize(ar, size);
+
     obj.resize(size);
 
     typename std::list<T>::iterator it = obj.begin();
@@ -543,7 +544,7 @@
     (void)is_ref;
 
     size = obj->size();
-    ar & size;
+    serialize_csize(ar, size);
 
     typename std::map<T1, T2>::iterator it = obj->begin();
     typename std::map<T1, T2>::iterator end = obj->end();
@@ -579,7 +580,7 @@
 
     obj = new std::map<T1, T2>;
 
-    ar & size;
+    serialize_csize(ar, size);
 
     std::pair<T1, T2> p;
 
@@ -605,7 +606,7 @@
   if (ar.is_serializing_out())
   {
     csize s = obj.size();
-    ar & s;
+    serialize_csize(ar, s);
 
     typename std::map<T1, T2, Tcomp>::iterator it = obj.begin();
     typename std::map<T1, T2, Tcomp>::iterator end = obj.end();
@@ -620,7 +621,7 @@
   else
   {
     csize s;
-    ar & s;
+    serialize_csize(ar, s);
 
     std::pair<T1, T2> p;
 
@@ -653,7 +654,7 @@
     size = obj.size();
 
     ar & sync;
-    ar & size;
+    serialize_csize(ar, size);
 
     typename HashMap<T, V, Tcomp>::iterator it = obj.begin();
     typename HashMap<T, V, Tcomp>::iterator end = obj.end();
@@ -668,7 +669,7 @@
   else
   {
     ar & sync;
-    ar & size;
+    serialize_csize(ar, size);
 
     obj.theNumEntries = 0;
     obj.theInitialSize = obj.theHashTabSize;
@@ -730,7 +731,7 @@
     ar & capacity;
     ar & sync;
     ar & comp;
-    ar & size;
+    serialize_csize(ar, size);
 
     ar.set_is_temp_field(false);
 
@@ -771,7 +772,7 @@
     ar & capacity;
     ar & sync;
     ar & comp;
-    ar & size;
+    serialize_csize(ar, size);
 
     ar.set_is_temp_field(false);
 

=== modified file 'src/zorbaserialization/serialize_zorba_types.cpp'
--- src/zorbaserialization/serialize_zorba_types.cpp	2012-06-20 20:19:54 +0000
+++ src/zorbaserialization/serialize_zorba_types.cpp	2012-06-22 15:24:24 +0000
@@ -1355,7 +1355,7 @@
     iterator_to_vector(iter, childs);
     std::vector<store::Item_t>::iterator  child_it;
     csize child_count = childs.size();
-    ar & child_count;
+    serialize_csize(ar, child_count);
 
     for(child_it = childs.begin(); child_it != childs.end(); ++child_it)
     {
@@ -1369,7 +1369,7 @@
   else
   {
     csize child_count;
-    ar & child_count;
+    serialize_csize(ar, child_count);
 
     for (csize i = 0; i < child_count; ++i)
     {

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to