tabbing
[iotcloud.git] / version2 / src / C / LastMessage.cc
index 083f004a46a1ca1cad434699beb73a61a07b6b6d..92cf608b55adee58a550ea11afe0cef91cb9b41e 100644 (file)
@@ -1,4 +1,6 @@
-
+#include "LastMessage.h"
+#include "Slot.h"
+#include "ByteBuffer.h"
 
 /**
  * This Entry records the last message sent by a given machine.
@@ -6,48 +8,14 @@
  * @version 1.0
  */
 
-
-class LastMessage extends Entry {
-       int64_t machineid;
-       int64_t seqnum;
-
-       LastMessage(Slot slot, int64_t _machineid, int64_t _seqnum) {
-               super(slot);
-               machineid=_machineid;
-               seqnum=_seqnum;
-       }
-
-       int64_t getMachineID() {
-               return machineid;
-       }
-
-       int64_t getSequenceNumber() {
-               return seqnum;
-       }
-
-       static Entry decode(Slot slot, ByteBuffer bb) {
-               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);
-       }
-
-       int getSize() {
-               return 2*sizeof(int64_t)+sizeof(char);
-       }
-
-       char getType() {
-               return Entry.TypeLastMessage;
-       }
-
-       Entry getCopy(Slot s) {
-               return new LastMessage(s, machineid, seqnum);
-       }
+Entry *LastMessage_decode(Slot *slot, ByteBuffer *bb) {
+       int64_t machineid = bb->getLong();
+       int64_t seqnum = bb->getLong();
+       return new LastMessage(slot, machineid, seqnum);
 }
 
-
+void LastMessage::encode(ByteBuffer *bb) {
+       bb->put(TypeLastMessage);
+       bb->putLong(machineid);
+       bb->putLong(seqnum);
+}