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