X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=version2%2Fsrc%2FC%2FSlotIndexer.cc;fp=version2%2Fsrc%2FC%2FSlotIndexer.cc;h=0000000000000000000000000000000000000000;hb=786e40250f31eff04eec25bbcaae3cd916fedb14;hp=b49ca454e749953f152d9ef85f0caf75933675b9;hpb=3f24bffc82ebfe2730308b63100af08645316577;p=iotcloud.git diff --git a/version2/src/C/SlotIndexer.cc b/version2/src/C/SlotIndexer.cc deleted file mode 100644 index b49ca45..0000000 --- a/version2/src/C/SlotIndexer.cc +++ /dev/null @@ -1,27 +0,0 @@ -#include "SlotIndexer.h" -#include "Slot.h" -#include "Error.h" -#include "SlotBuffer.h" -/** - * Slot indexer allows slots in both the slot buffer and the new - * server response to looked up in a consistent fashion. - * @author Brian Demsky - * @version 1.0 - */ - -SlotIndexer::SlotIndexer(Array *_updates, SlotBuffer *_buffer) : - updates(_updates), - buffer(_buffer), - firstslotseqnum(updates->get(0)->getSequenceNumber()) { -} - -Slot *SlotIndexer::getSlot(int64_t seqnum) { - if (seqnum >= firstslotseqnum) { - int32_t offset = (int32_t) (seqnum - firstslotseqnum); - if (((uint32_t)offset) >= updates->length()) - throw new Error("Invalid Slot Sequence Number Reference"); - else - return updates->get(offset); - } else - return buffer->getSlot(seqnum); -}