/* */ #include "RequestSlot.h" #include "Util.h" RequestSlot::RequestSlot(int index, int begin, int length, int blockIndex) :index(index), begin(begin), length(length), blockIndex(blockIndex) {} RequestSlot::RequestSlot(const RequestSlot& requestSlot) { copy(requestSlot); } void RequestSlot::copy(const RequestSlot& requestSlot) { index = requestSlot.index; begin = requestSlot.begin; length = requestSlot.length; blockIndex = requestSlot.blockIndex; dispatchedTime = requestSlot.dispatchedTime; } RequestSlot RequestSlot::nullSlot(0, 0, 0, 0); void RequestSlot::setDispatchedTime() { dispatchedTime.reset(); } bool RequestSlot::isTimeout(int timeoutSec) const { return dispatchedTime.differenceInMillis() > timeoutSec*1000; } int RequestSlot::getLatencyInMillis() const { return dispatchedTime.differenceInMillis(); } bool RequestSlot::isNull(const RequestSlot& requestSlot) { return requestSlot.index == 0 && requestSlot.begin == 0&& requestSlot.length == 0; }