Compiles
[iotcloud.git] / version2 / src / C / LastMessage.h
1 #ifndef LASTMESSAGE_H
2 #define LASTMESSAGE_H
3
4 #include "common.h"
5 #include "Entry.h"
6
7 /**
8  * This Entry records the last message sent by a given machine.
9  * @author Brian Demsky <bdemsky@uci.edu>
10  * @version 1.0
11  */
12
13 class LastMessage : public Entry {
14 private:
15         int64_t machineid;
16         int64_t seqnum;
17
18 public:
19         LastMessage(Slot *slot, int64_t _machineid, int64_t _seqnum) :
20                 Entry(slot),
21                 machineid(_machineid),
22                 seqnum(_seqnum) {
23         }
24         int64_t getMachineID() { return machineid; }
25         int64_t getSequenceNumber() { return seqnum; }
26         void encode(ByteBuffer *bb);
27         int getSize() { return 2 * sizeof(int64_t) + sizeof(char); }
28         char getType() { return TypeLastMessage; }
29         Entry *getCopy(Slot *s) { return new LastMessage(s, machineid, seqnum); }
30 };
31
32 Entry *LastMessage_decode(Slot *slot, ByteBuffer *bb);
33 #endif