edits
[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
14 class LastMessage : public Entry {
15 private:
16         int64_t machineid;
17         int64_t seqnum;
18
19 public:
20         LastMessage(Slot *slot, int64_t _machineid, int64_t _seqnum) :
21                 Entry(slot),
22                 machineid(_machineid),
23                 seqnum(_seqnum) {
24         }
25
26         int64_t getMachineID() { return machineid; }
27         int64_t getSequenceNumber() { return seqnum; }
28         void encode(ByteBuffer *bb);
29         int getSize() { return 2 * sizeof(int64_t) + sizeof(char); }
30         char getType() { return TypeLastMessage; }
31         Entry *getCopy(Slot *s) { return new LastMessage(s, machineid, seqnum); }
32 };
33
34 Entry *LastMessage_decode(Slot *slot, ByteBuffer *bb);
35 #endif