edits
[iotcloud.git] / version2 / src / C / SlotBuffer.cc
index 91ac22edc1e6667c2fce73d7cfd3dbba06c03402..ad78b3eeedf638a011828b1832cf326832cf33ae 100644 (file)
@@ -1,4 +1,5 @@
-#include"SlotBuffer.h"
+#include "SlotBuffer.h"
+#include "Slot.h"
 /**
  * Circular buffer that holds the live set of slots.
  * @author Brian Demsky
@@ -25,8 +26,8 @@ int SlotBuffer::capacity() {
 void SlotBuffer::resize(int newsize) {
        if (newsize == (array->length() - 1))
                return;
-       
-       Array<Slot *> * newarray = new Array<Slot *>(newsize + 1);
+
+       Array<Slot *> *newarray = new Array<Slot *>(newsize + 1);
        int currsize = size();
        int index = tail;
        for (int i = 0; i < currsize; i++) {
@@ -51,9 +52,9 @@ void SlotBuffer::incrementTail() {
                tail = 0;
 }
 
-void SlotBuffer::putSlot(Slot * s) {
+void SlotBuffer::putSlot(Slot *s) {
        int64_t checkNum = (getNewestSeqNum() + 1);
-       
+
        if (checkNum != s->getSequenceNumber()) {
                // We have a gap so expunge all our slots
                oldestseqn = s->getSequenceNumber();
@@ -62,10 +63,10 @@ void SlotBuffer::putSlot(Slot * s) {
                array->set(0, s);
                return;
        }
-       
+
        array->set(head, s);
        incrementHead();
-       
+
        if (oldestseqn == 0) {
                oldestseqn = s->getSequenceNumber();
        }
@@ -76,7 +77,7 @@ void SlotBuffer::putSlot(Slot * s) {
        }
 }
 
-Slot SlotBuffer::getSlot(int64_t seqnum) {
+Slot SlotBuffer::getSlot(int64_t seqnum) {
        int32_t diff = (int32_t) (seqnum - oldestseqn);
        int32_t index = diff + tail;
 
@@ -92,7 +93,7 @@ Slot SlotBuffer::getSlot(int64_t seqnum) {
                index -= array->length();
        }
 
-       if (index >= array->length) {
+       if (index >= array->length()) {
 
                return NULL;
        }