essential classes for arianna station protocol

Revision:
6:3ee695731d92
Parent:
2:a4bcca5cf1ca
--- a/SnBitUtils.h	Tue Oct 08 23:39:49 2013 +0000
+++ b/SnBitUtils.h	Thu Oct 30 05:53:49 2014 +0000
@@ -101,19 +101,21 @@
         return buf+sizeof(T);
     }
     
+    template<typename T>
     static
-    const char* ReadFrom(const char* const buf, char* const x,
+    const char* ReadFrom(const char* const buf, T* const x,
                          const uint32_t slen) {
-        // just a byte copy. assumes char is 1 byte
-        memcpy(x, buf, slen);
+        // just a byte copy
+        memcpy(x, buf, slen*sizeof(T));
         return buf+slen;
     }
     
+    template<typename T>
     static
-    char* WriteTo(char* const buf, const char* const x,
+    char* WriteTo(char* const buf, const T* const x,
                   const uint32_t slen) {
-        // just a byte copy. assumes char is 1 byte
-        memcpy(buf, x, slen);
+        // just a byte copy
+        memcpy(buf, x, slen*sizeof(T));
         return buf+slen;
     }