Index: code/branches/FICN/src/network/Synchronisable.cc
===================================================================
--- code/branches/FICN/src/network/Synchronisable.cc	(revision 531)
+++ code/branches/FICN/src/network/Synchronisable.cc	(revision 565)
@@ -26,5 +26,5 @@
   datasize=0;
   objectID=idCounter++;
-  //registerAllVariables();
+//   registerAllVariables();
 }
 
@@ -41,7 +41,7 @@
  * @param size size of the datatype the variable consists of
  */
-void Synchronisable::registerVar(const void *var, int size){
+void Synchronisable::registerVar(const void *var, int size, variableType t){
   // create temporary synch.Var struct
-  synchronisableVariable temp={size, var};
+  synchronisableVariable temp={size, var, t};
   // increase datasize
   datasize+=sizeof(int)+size;
@@ -65,5 +65,8 @@
   for(i=syncList.begin(); i!=syncList.end(); i++){
     // increase size (size of variable and size of size of variable ;)
-    totalsize+=sizeof(int)+i->size;
+    if(i->type == STRING)
+      totalsize+=sizeof(int)+((std::string *)i->var)->length()+1;
+    else
+      totalsize+=sizeof(int)+i->size;
   }
   syncData retVal;
@@ -77,10 +80,16 @@
   int n=0;
   for(i=syncList.begin(); n<totalsize && i!=syncList.end(); i++){
-	//CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID*
     std::memcpy(retVal.data+n, (const void*)(i->size), sizeof(int));
     n+=sizeof(int);
-    //CHANGED: i->var TO (const void*)(&(i->var)) SINCE var IS A POINTER, NO & BEFORE i
-    std::memcpy(retVal.data+n, (const void*)(i->var), i->size);
-    n+=i->size;
+    switch(i->type){
+    case STRING:
+      std::memcpy(retVal.data+n, (const void *)(((std::string *)i->var)->c_str()), ((std::string *)i->var)->length()+1);
+      n+=((std::string *)i->var)->length()+1;
+      break;
+    case DATA:
+      std::memcpy(retVal.data+n, ((const void*)i->var), i->size);
+      n+=i->size;
+      break;
+    }
   }
   return retVal;
@@ -107,10 +116,16 @@
   int n=0;
   for(i=syncList.begin(); n<datasize && i!=syncList.end(); i++){
-        //CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID*
     std::memcpy(retVal.data+n, (const void*)(i->size), sizeof(int));
     n+=sizeof(int);
-    //CHANGED: i->var TO (const void*)(&(i->var)) SINCE var IS A POINTER, NO & BEFORE i
-    std::memcpy(retVal.data+n, (const void*)(i->var), i->size);
-    n+=i->size;
+    switch(i->type){
+      case DATA:
+        std::memcpy(retVal.data+n, (const void*)(i->var), i->size);
+        n+=i->size;
+        break;
+      case STRING:
+        std::memcpy(retVal.data+n, (const void*)(((std::string *)i->var)->c_str()), ((std::string *)i->var)->length()+1);
+        n+=((std::string *) i->var)->length()+1;
+        break;
+    }
   }
   return retVal;
@@ -126,9 +141,18 @@
   std::list<synchronisableVariable>::iterator i;
   for(i=syncList.begin(); i!=syncList.end(); i++){
-    if((int)*data==i->size){
-      data+=sizeof(int);
-      //CHANGED: THIS FROM i->var TO (void*)i->var SINCE var IS A CONST VOID* AND memcpy NEEDS A VOID* AS FIRST ARGUMENT
-      memcpy((void*)i->var, data, i->size);
-      data+=i->size;
+    if((int)*data==i->size || i->type==STRING){
+      switch(i->type){
+      case DATA:
+        data+=sizeof(int);
+        memcpy((void*)i->var, data, i->size);
+        data+=i->size;
+        break;
+      case STRING:
+        i->size = (int)*data;
+        data+=sizeof(int);
+        *((std::string *)i->var) = std::string((const char*)data);
+        data += i->size;
+        break;
+      }
     } else
       return false; //there was some problem with registerVar
@@ -142,5 +166,17 @@
  */
 int Synchronisable::getSize(){
-  return datasize;
+  int tsize=0;
+  std::list<synchronisableVariable>::iterator i;
+  for(i=syncList.begin(); i!=syncList.end(); i++){
+    switch(i->type){
+    case DATA:
+      tsize+=i->size;
+      break;
+    case STRING:
+      tsize+=((std::string *)i->var)->length()+1;
+      break;
+    }
+  }
+  return tsize;
 }
 
