2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Renamed member variables.
	* src/RequestSlot.cc
	* src/RequestSlot.h
pull/1/head
Tatsuhiro Tsujikawa 2010-06-12 13:39:33 +00:00
parent c087255984
commit 95f5c58903
3 changed files with 42 additions and 35 deletions

View File

@ -1,3 +1,9 @@
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Renamed member variables.
* src/RequestSlot.cc
* src/RequestSlot.h
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Renamed member variables. Renamed member variables.

View File

@ -40,16 +40,16 @@ namespace aria2 {
RequestSlot RequestSlot::nullSlot = RequestSlot(); RequestSlot RequestSlot::nullSlot = RequestSlot();
void RequestSlot::setDispatchedTime(time_t sec) { void RequestSlot::setDispatchedTime(time_t sec) {
dispatchedTime.reset(sec); _dispatchedTime.reset(sec);
} }
bool RequestSlot::isTimeout(time_t timeoutSec) const { bool RequestSlot::isTimeout(time_t timeoutSec) const {
return dispatchedTime.difference(global::wallclock) >= timeoutSec; return _dispatchedTime.difference(global::wallclock) >= timeoutSec;
} }
bool RequestSlot::isNull(const RequestSlot& requestSlot) { bool RequestSlot::isNull(const RequestSlot& requestSlot) {
return requestSlot.index == 0 && requestSlot.begin == 0&& return requestSlot._index == 0 && requestSlot._begin == 0&&
requestSlot.length == 0; requestSlot._length == 0;
} }
} // namespace aria2 } // namespace aria2

View File

@ -44,11 +44,11 @@ namespace aria2 {
class RequestSlot { class RequestSlot {
private: private:
Timer dispatchedTime; Timer _dispatchedTime;
size_t index; size_t _index;
uint32_t begin; uint32_t _begin;
size_t length; size_t _length;
size_t blockIndex; size_t _blockIndex;
// This is the piece whose index is index of this RequestSlot has. // This is the piece whose index is index of this RequestSlot has.
// To detect duplicate RequestSlot, we have to find the piece using // To detect duplicate RequestSlot, we have to find the piece using
@ -60,30 +60,31 @@ private:
// inlined for performance reason // inlined for performance reason
void copy(const RequestSlot& requestSlot) void copy(const RequestSlot& requestSlot)
{ {
dispatchedTime = requestSlot.dispatchedTime; _dispatchedTime = requestSlot._dispatchedTime;
index = requestSlot.index; _index = requestSlot._index;
begin = requestSlot.begin; _begin = requestSlot._begin;
length = requestSlot.length; _length = requestSlot._length;
blockIndex = requestSlot.blockIndex; _blockIndex = requestSlot._blockIndex;
_piece = requestSlot._piece; _piece = requestSlot._piece;
} }
public: public:
RequestSlot(size_t index, uint32_t begin, size_t length, size_t blockIndex, RequestSlot(size_t index, uint32_t begin, size_t length, size_t blockIndex,
const SharedHandle<Piece>& piece = SharedHandle<Piece>()): const SharedHandle<Piece>& piece = SharedHandle<Piece>()):
dispatchedTime(global::wallclock), _dispatchedTime(global::wallclock),
index(index), begin(begin), length(length), blockIndex(blockIndex), _index(index), _begin(begin), _length(length), _blockIndex(blockIndex),
_piece(piece) {} _piece(piece) {}
RequestSlot(const RequestSlot& requestSlot): RequestSlot(const RequestSlot& requestSlot):
dispatchedTime(requestSlot.dispatchedTime), _dispatchedTime(requestSlot._dispatchedTime),
index(requestSlot.index), _index(requestSlot._index),
begin(requestSlot.begin), _begin(requestSlot._begin),
length(requestSlot.length), _length(requestSlot._length),
blockIndex(requestSlot.blockIndex), _blockIndex(requestSlot._blockIndex),
_piece(requestSlot._piece) {} _piece(requestSlot._piece) {}
RequestSlot():dispatchedTime(0), index(0), begin(0), length(0), blockIndex(0) RequestSlot():_dispatchedTime(0), _index(0), _begin(0), _length(0),
_blockIndex(0)
{} {}
~RequestSlot() {} ~RequestSlot() {}
@ -98,8 +99,8 @@ public:
bool operator==(const RequestSlot& requestSlot) const bool operator==(const RequestSlot& requestSlot) const
{ {
return index == requestSlot.index && begin == requestSlot.begin return _index == requestSlot._index && _begin == requestSlot._begin
&& length == requestSlot.length; && _length == requestSlot._length;
} }
bool operator!=(const RequestSlot& requestSlot) const bool operator!=(const RequestSlot& requestSlot) const
@ -109,10 +110,10 @@ public:
bool operator<(const RequestSlot& requestSlot) const bool operator<(const RequestSlot& requestSlot) const
{ {
if(index == requestSlot.index) { if(_index == requestSlot._index) {
return begin < requestSlot.begin; return _begin < requestSlot._begin;
} else { } else {
return index < requestSlot.index; return _index < requestSlot._index;
} }
} }
@ -120,17 +121,17 @@ public:
bool isTimeout(time_t timeoutSec) const; bool isTimeout(time_t timeoutSec) const;
size_t getIndex() const { return index; } size_t getIndex() const { return _index; }
void setIndex(size_t index) { this->index = index; } void setIndex(size_t index) { _index = index; }
uint32_t getBegin() const { return begin; } uint32_t getBegin() const { return _begin; }
void setBegin(uint32_t begin) { this->begin = begin; } void setBegin(uint32_t begin) { _begin = begin; }
size_t getLength() const { return length; } size_t getLength() const { return _length; }
void setLength(size_t length) { this->length = length; } void setLength(size_t length) { _length = length; }
size_t getBlockIndex() const { return blockIndex; } size_t getBlockIndex() const { return _blockIndex; }
void setBlockIndex(size_t blockIndex) { this->blockIndex = blockIndex; } void setBlockIndex(size_t blockIndex) { _blockIndex = blockIndex; }
const SharedHandle<Piece>& getPiece() const const SharedHandle<Piece>& getPiece() const
{ {