1 #include "SlotIndexer.h"
4 #include "SlotBuffer.h"
6 * Slot indexer allows slots in both the slot buffer and the new
7 * server response to looked up in a consistent fashion.
12 SlotIndexer::SlotIndexer(Array<Slot *> *_updates, SlotBuffer *_buffer) :
15 firstslotseqnum(updates->get(0)->getSequenceNumber()) {
18 Slot *SlotIndexer::getSlot(int64_t seqnum) {
19 if (seqnum >= firstslotseqnum) {
20 int32_t offset = (int32_t) (seqnum - firstslotseqnum);
21 if (((uint32_t)offset) >= updates->length())
22 //throw new Error("Invalid Slot Sequence Number Reference");
23 myerror("Invalid Slot Sequence Number Reference");
25 return updates->get(offset);
27 return buffer->getSlot(seqnum);