Edit
authorbdemsky <bdemsky@uci.edu>
Fri, 19 Jan 2018 01:44:38 +0000 (17:44 -0800)
committerbdemsky <bdemsky@uci.edu>
Fri, 19 Jan 2018 01:44:38 +0000 (17:44 -0800)
version2/src/C/CommitPart.cc
version2/src/C/CommitPart.h
version2/src/C/Entry.cc
version2/src/C/KeyValue.cc
version2/src/C/KeyValue.h
version2/src/C/LastMessage.cc
version2/src/C/LastMessage.h
version2/src/C/RejectedMessage.cc
version2/src/C/TableStatus.cc
version2/src/C/TransactionPart.cc
version2/src/C/TransactionPart.h

index 32ddd61..3b3a10e 100644 (file)
@@ -81,35 +81,35 @@ class CommitPart extends Entry{
     }
 
     static Entry decode(Slot s, ByteBuffer bb) {
-        int64_t machineId = bb.getLong();
-        int64_t sequenceNumber = bb.getLong();
-        int64_t transactionSequenceNumber = bb.getLong();
-        int partNumber = bb.getInt();
-        int dataSize = bb.getInt();
-        Boolean isLastPart = bb.get() == 1;
+        int64_t machineId = bb->getLong();
+        int64_t sequenceNumber = bb->getLong();
+        int64_t transactionSequenceNumber = bb->getLong();
+        int partNumber = bb->getInt();
+        int dataSize = bb->getInt();
+        Boolean isLastPart = bb->get() == 1;
 
         // Get the data
         char[] data = new char[dataSize];
-        bb.get(data);
+        bb->get(data);
 
         return new CommitPart(s, machineId, sequenceNumber, transactionSequenceNumber, partNumber, data, isLastPart);
     }
 
     void encode(ByteBuffer bb) {
-        bb.put(Entry.TypeCommitPart);
-        bb.putLong(machineId);
-        bb.putLong(sequenceNumber);
-        bb.putLong(transactionSequenceNumber);
-        bb.putInt(partNumber);
-        bb.putInt(data.length);
+        bb->put(Entry.TypeCommitPart);
+        bb->putLong(machineId);
+        bb->putLong(sequenceNumber);
+        bb->putLong(transactionSequenceNumber);
+        bb->putInt(partNumber);
+        bb->putInt(data.length);
 
         if (isLastPart) {
-            bb.put((char)1);
+            bb->put((char)1);
         } else {
-            bb.put((char)0);
+            bb->put((char)0);
         }
 
-        bb.put(data);
+        bb->put(data);
     }
 
     char getType() {
index 6edba90..4a481ad 100644 (file)
@@ -81,35 +81,35 @@ class CommitPart extends Entry{
     }
 
     static Entry decode(Slot s, ByteBuffer bb) {
-        int64_t machineId = bb.getLong();
-        int64_t sequenceNumber = bb.getLong();
-        int64_t transactionSequenceNumber = bb.getLong();
-        int partNumber = bb.getInt();
-        int dataSize = bb.getInt();
-        Boolean isLastPart = bb.get() == 1;
+        int64_t machineId = bb->getLong();
+        int64_t sequenceNumber = bb->getLong();
+        int64_t transactionSequenceNumber = bb->getLong();
+        int partNumber = bb->getInt();
+        int dataSize = bb->getInt();
+        Boolean isLastPart = bb->get() == 1;
 
         // Get the data
         char[] data = new char[dataSize];
-        bb.get(data);
+        bb->get(data);
 
         return new CommitPart(s, machineId, sequenceNumber, transactionSequenceNumber, partNumber, data, isLastPart);
     }
 
     public void encode(ByteBuffer bb) {
-        bb.put(Entry.TypeCommitPart);
-        bb.putLong(machineId);
-        bb.putLong(sequenceNumber);
-        bb.putLong(transactionSequenceNumber);
-        bb.putInt(partNumber);
-        bb.putInt(data.length);
+        bb->put(Entry.TypeCommitPart);
+        bb->putLong(machineId);
+        bb->putLong(sequenceNumber);
+        bb->putLong(transactionSequenceNumber);
+        bb->putInt(partNumber);
+        bb->putInt(data.length);
 
         if (isLastPart) {
-            bb.put((char)1);
+            bb->put((char)1);
         } else {
-            bb.put((char)0);
+            bb->put((char)0);
         }
 
-        bb.put(data);
+        bb->put(data);
     }
 
     public char getType() {
index 1a06288..2bde6eb 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 Entry * Entry_decode(Slot * slot, ByteBuffer * bb) {
-  char type = bb.get();
+  char type = bb->get();
   switch (type) {
     
   case TypeCommitPart:
index a906de5..0be46c5 100644 (file)
@@ -23,14 +23,14 @@ class KeyValue { /*extends Entry */
        }
 
        static KeyValue decode(ByteBuffer bb) {
-               int keylength = bb.getInt();
-               int valuelength = bb.getInt();
+               int keylength = bb->getInt();
+               int valuelength = bb->getInt();
                char[] key = new char[keylength];
-               bb.get(key);
+               bb->get(key);
 
                if (valuelength != 0) {
                        char[] value = new char[valuelength];
-                       bb.get(value);
+                       bb->get(value);
                        return new KeyValue(IoTString.shallow(key), IoTString.shallow(value));
                }
 
@@ -38,18 +38,18 @@ class KeyValue { /*extends Entry */
        }
 
        void encode(ByteBuffer bb) {
-               bb.putInt(key.length());
+               bb->putInt(key.length());
 
                if (value != NULL) {
-                       bb.putInt(value.length());
+                       bb->putInt(value.length());
                } else {
-                       bb.putInt(0);
+                       bb->putInt(0);
                }
 
-               bb.put(key.internalBytes());
+               bb->put(key.internalBytes());
 
                if (value != NULL) {
-                       bb.put(value.internalBytes());
+                       bb->put(value.internalBytes());
                }
        }
 
index e63c164..dadda7b 100644 (file)
@@ -23,14 +23,14 @@ class KeyValue { /*extends Entry */
        }
 
        static KeyValue decode(ByteBuffer bb) {
-               int keylength = bb.getInt();
-               int valuelength = bb.getInt();
+               int keylength = bb->getInt();
+               int valuelength = bb->getInt();
                char[] key = new char[keylength];
-               bb.get(key);
+               bb->get(key);
 
                if (valuelength != 0) {
                        char[] value = new char[valuelength];
-                       bb.get(value);
+                       bb->get(value);
                        return new KeyValue(IoTString.shallow(key), IoTString.shallow(value));
                }
 
@@ -38,18 +38,18 @@ class KeyValue { /*extends Entry */
        }
 
        public void encode(ByteBuffer bb) {
-               bb.putInt(key.length());
+               bb->putInt(key.length());
 
                if (value != NULL) {
-                       bb.putInt(value.length());
+                       bb->putInt(value.length());
                } else {
-                       bb.putInt(0);
+                       bb->putInt(0);
                }
 
-               bb.put(key.internalBytes());
+               bb->put(key.internalBytes());
 
                if (value != NULL) {
-                       bb.put(value.internalBytes());
+                       bb->put(value.internalBytes());
                }
        }
 
index 083f004..036e247 100644 (file)
@@ -26,15 +26,15 @@ class LastMessage extends Entry {
        }
 
        static Entry decode(Slot slot, ByteBuffer bb) {
-               int64_t machineid=bb.getLong();
-               int64_t seqnum=bb.getLong();
+               int64_t machineid=bb->getLong();
+               int64_t seqnum=bb->getLong();
                return new LastMessage(slot, machineid, seqnum);
        }
 
        void encode(ByteBuffer bb) {
-               bb.put(Entry.TypeLastMessage);
-               bb.putLong(machineid);
-               bb.putLong(seqnum);
+               bb->put(Entry.TypeLastMessage);
+               bb->putLong(machineid);
+               bb->putLong(seqnum);
        }
 
        int getSize() {
index dec0db3..ef38af8 100644 (file)
@@ -26,15 +26,15 @@ class LastMessage extends Entry {
        }
 
        static Entry decode(Slot slot, ByteBuffer bb) {
-               int64_t machineid=bb.getLong();
-               int64_t seqnum=bb.getLong();
+               int64_t machineid=bb->getLong();
+               int64_t seqnum=bb->getLong();
                return new LastMessage(slot, machineid, seqnum);
        }
 
        public void encode(ByteBuffer bb) {
-               bb.put(Entry.TypeLastMessage);
-               bb.putLong(machineid);
-               bb.putLong(seqnum);
+               bb->put(Entry.TypeLastMessage);
+               bb->putLong(machineid);
+               bb->putLong(seqnum);
        }
 
        public int getSize() {
index 7cbac36..b1f441b 100644 (file)
  */
 
 Entry * RejectedMessage_decode(Slot * slot, ByteBuffer * bb) {
-       int64_t sequencenum=bb.getLong();
-       int64_t machineid=bb.getLong();
-       int64_t oldseqnum=bb.getLong();
-       int64_t newseqnum=bb.getLong();
-       char equalto=bb.get();
+       int64_t sequencenum=bb->getLong();
+       int64_t machineid=bb->getLong();
+       int64_t oldseqnum=bb->getLong();
+       int64_t newseqnum=bb->getLong();
+       char equalto=bb->get();
        return new RejectedMessage(slot,sequencenum, machineid, oldseqnum, newseqnum, equalto==1);
 }
 
@@ -25,7 +25,7 @@ void RejectedMessage::removeWatcher(int64_t machineid) {
 }
 
 void RejectedMessage::encode(ByteBuffer * bb) {
-       bb.put(TypeRejectedMessage);
+       bb->put(TypeRejectedMessage);
        bb->putLong(sequencenum);
        bb->putLong(machineid);
        bb->putLong(oldseqnum);
index 49fcb0f..b875350 100644 (file)
@@ -2,7 +2,7 @@
 #include "ByteBuffer.h"
 
 Entry * TableStatus_decode(Slot * slot, ByteBuffer * bb) {
-       int maxslots=bb.getInt();
+       int maxslots=bb->getInt();
        return new TableStatus(slot, maxslots);
 }
 
index 7931ae9..0d8e2c4 100644 (file)
@@ -88,16 +88,16 @@ class TransactionPart extends Entry {
     }
 
     static Entry decode(Slot s, ByteBuffer bb) {
-        int64_t sequenceNumber = bb.getLong();
-        int64_t machineId = bb.getLong();
-        int64_t arbitratorId = bb.getLong();
-        int64_t clientLocalSequenceNumber = bb.getLong();
-        int partNumber = bb.getInt();
-        int dataSize = bb.getInt();
-        Boolean isLastPart = (bb.get() == 1);
+        int64_t sequenceNumber = bb->getLong();
+        int64_t machineId = bb->getLong();
+        int64_t arbitratorId = bb->getLong();
+        int64_t clientLocalSequenceNumber = bb->getLong();
+        int partNumber = bb->getInt();
+        int dataSize = bb->getInt();
+        Boolean isLastPart = (bb->get() == 1);
         // Get the data
         char[] data = new char[dataSize];
-        bb.get(data);
+        bb->get(data);
 
         TransactionPart returnTransactionPart = new TransactionPart(s, machineId, arbitratorId, clientLocalSequenceNumber, partNumber, data, isLastPart);
         returnTransactionPart.setSequenceNumber(sequenceNumber);
@@ -106,21 +106,21 @@ class TransactionPart extends Entry {
     }
 
     void encode(ByteBuffer bb) {
-        bb.put(Entry.TypeTransactionPart);
-        bb.putLong(sequenceNumber);
-        bb.putLong(machineId);
-        bb.putLong(arbitratorId);
-        bb.putLong(clientLocalSequenceNumber);
-        bb.putInt(partNumber);
-        bb.putInt(data.length);
+        bb->put(Entry.TypeTransactionPart);
+        bb->putLong(sequenceNumber);
+        bb->putLong(machineId);
+        bb->putLong(arbitratorId);
+        bb->putLong(clientLocalSequenceNumber);
+        bb->putInt(partNumber);
+        bb->putInt(data.length);
 
         if (isLastPart) {
-            bb.put((char)1);
+            bb->put((char)1);
         } else {
-            bb.put((char)0);
+            bb->put((char)0);
         }
 
-        bb.put(data);
+        bb->put(data);
     }
 
     char getType() {
index 5110f97..5d936df 100644 (file)
@@ -88,16 +88,16 @@ class TransactionPart extends Entry {
     }
 
     static Entry decode(Slot s, ByteBuffer bb) {
-        int64_t sequenceNumber = bb.getLong();
-        int64_t machineId = bb.getLong();
-        int64_t arbitratorId = bb.getLong();
-        int64_t clientLocalSequenceNumber = bb.getLong();
-        int partNumber = bb.getInt();
-        int dataSize = bb.getInt();
-        Boolean isLastPart = (bb.get() == 1);
+        int64_t sequenceNumber = bb->getLong();
+        int64_t machineId = bb->getLong();
+        int64_t arbitratorId = bb->getLong();
+        int64_t clientLocalSequenceNumber = bb->getLong();
+        int partNumber = bb->getInt();
+        int dataSize = bb->getInt();
+        Boolean isLastPart = (bb->get() == 1);
         // Get the data
         char[] data = new char[dataSize];
-        bb.get(data);
+        bb->get(data);
 
         TransactionPart returnTransactionPart = new TransactionPart(s, machineId, arbitratorId, clientLocalSequenceNumber, partNumber, data, isLastPart);
         returnTransactionPart.setSequenceNumber(sequenceNumber);
@@ -106,21 +106,21 @@ class TransactionPart extends Entry {
     }
 
     public void encode(ByteBuffer bb) {
-        bb.put(Entry.TypeTransactionPart);
-        bb.putLong(sequenceNumber);
-        bb.putLong(machineId);
-        bb.putLong(arbitratorId);
-        bb.putLong(clientLocalSequenceNumber);
-        bb.putInt(partNumber);
-        bb.putInt(data.length);
+        bb->put(Entry.TypeTransactionPart);
+        bb->putLong(sequenceNumber);
+        bb->putLong(machineId);
+        bb->putLong(arbitratorId);
+        bb->putLong(clientLocalSequenceNumber);
+        bb->putInt(partNumber);
+        bb->putInt(data.length);
 
         if (isLastPart) {
-            bb.put((char)1);
+            bb->put((char)1);
         } else {
-            bb.put((char)0);
+            bb->put((char)0);
         }
 
-        bb.put(data);
+        bb->put(data);
     }
 
     public char getType() {