Adding benchmark file for encrypted cloud storage.
[iotcloud.git] / version2 / src / C / Entry.cpp
1 #include "Entry.h"
2 #include "Slot.h"
3 #include "ByteBuffer.h"
4 #include "Abort.h"
5 #include "CommitPart.h"
6 #include "NewKey.h"
7 #include "LastMessage.h"
8 #include "RejectedMessage.h"
9 #include "TableStatus.h"
10 #include "TransactionPart.h"
11 /**
12  * Generic class that wraps all the different types of information
13  * that can be stored in a Slot.
14  * @author Brian Demsky <bdemsky@uci.edu>
15  * @version 1.0
16  */
17
18 Entry *Entry_decode(Slot *slot, ByteBuffer *bb) {
19         char type = bb->get();
20         switch (type) {
21         case TypeCommitPart:
22                 return CommitPart_decode(slot, bb);
23         case TypeAbort:
24                 return Abort_decode(slot, bb);
25         case TypeTransactionPart:
26                 return TransactionPart_decode(slot, bb);
27         case TypeNewKey:
28                 return NewKey_decode(slot, bb);
29         case TypeLastMessage:
30                 return LastMessage_decode(slot, bb);
31         case TypeRejectedMessage:
32                 return RejectedMessage_decode(slot, bb);
33         case TypeTableStatus:
34                 return TableStatus_decode(slot, bb);
35
36         default:
37                 ASSERT(0);
38         }
39 }
40
41 void Entry::setDead() {
42         if (islive) {
43                 islive = false;
44                 if (parentslot != NULL) {
45                         parentslot->decrementLiveCount();
46                 }
47         }
48 }