X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=version2%2Fsrc%2FC%2FTableStatus.h;h=ce2576e97702b42ba9a09c5237fe34b1b3706154;hb=b47765b628c0c160dd13622f8e241c377b8ce3cb;hp=9637f7a17efaa7086fe7aafa5aaeeaeb5b6f0a5c;hpb=47ee5448a5177a43a6567626424c4ca25e2fd554;p=iotcloud.git diff --git a/version2/src/C/TableStatus.h b/version2/src/C/TableStatus.h index 9637f7a..ce2576e 100644 --- a/version2/src/C/TableStatus.h +++ b/version2/src/C/TableStatus.h @@ -1,3 +1,7 @@ +#ifndef TABLESTATUS_H +#define TABLESTATUS_H +#include "common.h" +#include "Entry.h" /** * TableStatus entries record the current size of the data structure @@ -6,38 +10,22 @@ * @version 1.0 */ - -class TableStatus extends Entry { - private int maxslots; - - TableStatus(Slot slot, int _maxslots) { - super(slot); - maxslots=_maxslots; - } - - int getMaxSlots() { - return maxslots; - } - - static Entry decode(Slot slot, ByteBuffer bb) { - int maxslots=bb.getInt(); - return new TableStatus(slot, maxslots); - } - - void encode(ByteBuffer bb) { - bb.put(Entry.TypeTableStatus); - bb.putInt(maxslots); - } - - int getSize() { - return sizeof(int32_t)+sizeof(char); - } - - char getType() { - return Entry.TypeTableStatus; - } - - Entry getCopy(Slot s) { - return new TableStatus(s, maxslots); - } -} +class TableStatus : public Entry { + private: + int maxslots; + + public: + TableStatus(Slot * slot, int _maxslots) : Entry(slot), + maxslots(_maxslots) { + } + int getMaxSlots() { return maxslots; } + void encode(ByteBuffer *bb); + int getSize() { return sizeof(int32_t)+sizeof(char); } + + char getType() { return TypeTableStatus; } + + Entry * getCopy(Slot * s) { return new TableStatus(s, maxslots); } +}; + +Entry * TableStatus_decode(Slot * slot, ByteBuffer * bb); +#endif