Start port
[iotcloud.git] / version2 / src / C / TableStatus.h
1
2 /**
3  * TableStatus entries record the current size of the data structure
4  * in slots.  Used to remember the size and to perform resizes.
5  * @author Brian Demsky
6  * @version 1.0
7  */
8
9
10 class TableStatus extends Entry {
11         private int maxslots;
12
13         TableStatus(Slot slot, int _maxslots) {
14                 super(slot);
15                 maxslots=_maxslots;
16         }
17
18         int getMaxSlots() {
19                 return maxslots;
20         }
21
22         static Entry decode(Slot slot, ByteBuffer bb) {
23                 int maxslots=bb.getInt();
24                 return new TableStatus(slot, maxslots);
25         }
26
27         void encode(ByteBuffer bb) {
28                 bb.put(Entry.TypeTableStatus);
29                 bb.putInt(maxslots);
30         }
31
32         int getSize() {
33                 return sizeof(int32_t)+sizeof(char);
34         }
35
36         char getType() {
37                 return Entry.TypeTableStatus;
38         }
39
40         Entry getCopy(Slot s) {
41                 return new TableStatus(s, maxslots);
42         }
43 }