mirror of https://gitee.com/bigwinds/arangodb
constified
This commit is contained in:
parent
8ef9d1ea78
commit
c89cf82c6b
|
@ -200,7 +200,7 @@ static int FillLookupOperator (TRI_index_operator_t* slOperator,
|
||||||
// --SECTION-- public methods
|
// --SECTION-- public methods
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
size_t SkiplistIterator::size () {
|
size_t SkiplistIterator::size () const {
|
||||||
return _intervals.size();
|
return _intervals.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ void SkiplistIterator::initCursor () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkiplistIterator::hasNext () {
|
bool SkiplistIterator::hasNext () const {
|
||||||
if (_reverse) {
|
if (_reverse) {
|
||||||
return hasPrevIteration();
|
return hasPrevIteration();
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ void SkiplistIterator::findHelper (
|
||||||
/// interval or before it - without advancing the iterator.
|
/// interval or before it - without advancing the iterator.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool SkiplistIterator::hasPrevIteration () {
|
bool SkiplistIterator::hasPrevIteration () const {
|
||||||
// ...........................................................................
|
// ...........................................................................
|
||||||
// if we have more intervals than the one we are currently working
|
// if we have more intervals than the one we are currently working
|
||||||
// on then of course we have a previous doc, because intervals are nonempty.
|
// on then of course we have a previous doc, because intervals are nonempty.
|
||||||
|
@ -523,7 +523,7 @@ bool SkiplistIterator::hasPrevIteration () {
|
||||||
/// interval - without advancing the iterator.
|
/// interval - without advancing the iterator.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool SkiplistIterator::hasNextIteration () {
|
bool SkiplistIterator::hasNextIteration () const {
|
||||||
if (_cursor == nullptr) {
|
if (_cursor == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -814,7 +814,7 @@ size_t SkiplistIndex::elementSize () const {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int SkiplistIndex::KeyElementComparator::operator() (TRI_skiplist_index_key_t const* leftKey,
|
int SkiplistIndex::KeyElementComparator::operator() (TRI_skiplist_index_key_t const* leftKey,
|
||||||
TRI_index_element_t const* rightElement) {
|
TRI_index_element_t const* rightElement) const {
|
||||||
|
|
||||||
TRI_ASSERT(nullptr != leftKey);
|
TRI_ASSERT(nullptr != leftKey);
|
||||||
TRI_ASSERT(nullptr != rightElement);
|
TRI_ASSERT(nullptr != rightElement);
|
||||||
|
@ -842,7 +842,7 @@ int SkiplistIndex::KeyElementComparator::operator() (TRI_skiplist_index_key_t co
|
||||||
|
|
||||||
int SkiplistIndex::ElementElementComparator::operator() (TRI_index_element_t const* leftElement,
|
int SkiplistIndex::ElementElementComparator::operator() (TRI_index_element_t const* leftElement,
|
||||||
TRI_index_element_t const* rightElement,
|
TRI_index_element_t const* rightElement,
|
||||||
triagens::basics::SkipListCmpType cmptype) {
|
triagens::basics::SkipListCmpType cmptype) const {
|
||||||
|
|
||||||
TRI_ASSERT(nullptr != leftElement);
|
TRI_ASSERT(nullptr != leftElement);
|
||||||
TRI_ASSERT(nullptr != rightElement);
|
TRI_ASSERT(nullptr != rightElement);
|
||||||
|
|
|
@ -81,7 +81,8 @@ namespace triagens {
|
||||||
|
|
||||||
SkiplistIteratorInterval ()
|
SkiplistIteratorInterval ()
|
||||||
: _leftEndPoint(nullptr),
|
: _leftEndPoint(nullptr),
|
||||||
_rightEndPoint(nullptr) { }
|
_rightEndPoint(nullptr) {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -90,7 +91,7 @@ namespace triagens {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SkiplistIndex* const _index;
|
SkiplistIndex const* _index;
|
||||||
size_t _currentInterval; // starts with 0, current interval used
|
size_t _currentInterval; // starts with 0, current interval used
|
||||||
bool _reverse;
|
bool _reverse;
|
||||||
Node* _cursor;
|
Node* _cursor;
|
||||||
|
@ -102,16 +103,16 @@ namespace triagens {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SkiplistIterator (
|
SkiplistIterator (SkiplistIndex const* idx,
|
||||||
SkiplistIndex* const idx,
|
bool reverse)
|
||||||
bool reverse
|
: _index(idx) ,
|
||||||
) : _index(idx) ,
|
|
||||||
_currentInterval(0),
|
_currentInterval(0),
|
||||||
_reverse(reverse),
|
_reverse(reverse),
|
||||||
_cursor(nullptr) {
|
_cursor(nullptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~SkiplistIterator () {}
|
~SkiplistIterator () {
|
||||||
|
}
|
||||||
|
|
||||||
// always holds the last node returned, initially equal to
|
// always holds the last node returned, initially equal to
|
||||||
// the _leftEndPoint of the first interval (or the
|
// the _leftEndPoint of the first interval (or the
|
||||||
|
@ -131,9 +132,9 @@ namespace triagens {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
size_t size ();
|
size_t size () const;
|
||||||
|
|
||||||
bool hasNext ();
|
bool hasNext () const;
|
||||||
|
|
||||||
TRI_index_element_t* next ();
|
TRI_index_element_t* next ();
|
||||||
|
|
||||||
|
@ -150,10 +151,10 @@ namespace triagens {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool hasPrevIteration ();
|
bool hasPrevIteration () const;
|
||||||
TRI_index_element_t* prevIteration ();
|
TRI_index_element_t* prevIteration ();
|
||||||
|
|
||||||
bool hasNextIteration ();
|
bool hasNextIteration () const;
|
||||||
TRI_index_element_t* nextIteration ();
|
TRI_index_element_t* nextIteration ();
|
||||||
|
|
||||||
bool findHelperIntervalIntersectionValid (
|
bool findHelperIntervalIntersectionValid (
|
||||||
|
@ -162,9 +163,7 @@ namespace triagens {
|
||||||
SkiplistIteratorInterval& interval
|
SkiplistIteratorInterval& interval
|
||||||
);
|
);
|
||||||
|
|
||||||
bool findHelperIntervalValid (
|
bool findHelperIntervalValid (SkiplistIteratorInterval const& interval);
|
||||||
SkiplistIteratorInterval const& interval
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -175,7 +174,7 @@ namespace triagens {
|
||||||
|
|
||||||
struct KeyElementComparator {
|
struct KeyElementComparator {
|
||||||
int operator() (TRI_skiplist_index_key_t const* leftKey,
|
int operator() (TRI_skiplist_index_key_t const* leftKey,
|
||||||
TRI_index_element_t const* rightElement);
|
TRI_index_element_t const* rightElement) const;
|
||||||
|
|
||||||
KeyElementComparator (SkiplistIndex* idx) {
|
KeyElementComparator (SkiplistIndex* idx) {
|
||||||
_idx = idx;
|
_idx = idx;
|
||||||
|
@ -189,7 +188,7 @@ namespace triagens {
|
||||||
struct ElementElementComparator {
|
struct ElementElementComparator {
|
||||||
int operator() (TRI_index_element_t const* leftElement,
|
int operator() (TRI_index_element_t const* leftElement,
|
||||||
TRI_index_element_t const* rightElement,
|
TRI_index_element_t const* rightElement,
|
||||||
triagens::basics::SkipListCmpType cmptype);
|
triagens::basics::SkipListCmpType cmptype) const;
|
||||||
|
|
||||||
ElementElementComparator (SkiplistIndex* idx) {
|
ElementElementComparator (SkiplistIndex* idx) {
|
||||||
_idx = idx;
|
_idx = idx;
|
||||||
|
|
|
@ -245,7 +245,7 @@ namespace triagens {
|
||||||
/// @brief return the successor node or nullptr if last node
|
/// @brief return the successor node or nullptr if last node
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Node* nextNode (Node* node) {
|
Node* nextNode (Node* node) const {
|
||||||
return node->_next[0];
|
return node->_next[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue