+#ifndef LASTMESSAGE_H
+#define LASTMESSAGE_H
+#include "common.h"
+#include "Entry.h"
/**
* This Entry records the last message sent by a given machine.
* @version 1.0
*/
-
-class LastMessage extends Entry {
- private int64_t machineid;
- private int64_t seqnum;
-
- public LastMessage(Slot slot, int64_t _machineid, int64_t _seqnum) {
- super(slot);
- machineid=_machineid;
- seqnum=_seqnum;
- }
-
- public int64_t getMachineID() {
- return machineid;
- }
-
- public 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);
- }
-
- public void encode(ByteBuffer bb) {
- bb->put(Entry.TypeLastMessage);
- bb->putLong(machineid);
- bb->putLong(seqnum);
- }
-
- public int getSize() {
- return 2*sizeof(int64_t)+sizeof(char);
- }
-
- public char getType() {
- return Entry.TypeLastMessage;
- }
-
- public Entry getCopy(Slot s) {
- return new LastMessage(s, machineid, seqnum);
- }
-}
-
-
+class LastMessage : public Entry {
+private:
+ int64_t machineid;
+ int64_t seqnum;
+
+public:
+ LastMessage(Slot *slot, int64_t _machineid, int64_t _seqnum) :
+ Entry(slot),
+ machineid(_machineid),
+ seqnum(_seqnum) {
+ }
+ int64_t getMachineID() { return machineid; }
+ int64_t getSequenceNumber() { return seqnum; }
+ void encode(ByteBuffer *bb);
+ int getSize() { return 2 * sizeof(int64_t) + sizeof(char); }
+ char getType() { return TypeLastMessage; }
+ Entry *getCopy(Slot *s) { return new LastMessage(s, machineid, seqnum); }
+};
+
+Entry *LastMessage_decode(Slot *slot, ByteBuffer *bb);
+#endif