1
0
Fork 0

constified

This commit is contained in:
Jan Steemann 2015-09-02 17:37:28 +02:00
parent 8ef9d1ea78
commit c89cf82c6b
3 changed files with 23 additions and 24 deletions

View File

@ -200,7 +200,7 @@ static int FillLookupOperator (TRI_index_operator_t* slOperator,
// --SECTION-- public methods
// -----------------------------------------------------------------------------
size_t SkiplistIterator::size () {
size_t SkiplistIterator::size () const {
return _intervals.size();
}
@ -223,7 +223,7 @@ void SkiplistIterator::initCursor () {
}
}
bool SkiplistIterator::hasNext () {
bool SkiplistIterator::hasNext () const {
if (_reverse) {
return hasPrevIteration();
}
@ -499,7 +499,7 @@ void SkiplistIterator::findHelper (
/// 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
// 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.
////////////////////////////////////////////////////////////////////////////////
bool SkiplistIterator::hasNextIteration () {
bool SkiplistIterator::hasNextIteration () const {
if (_cursor == nullptr) {
return false;
}
@ -814,7 +814,7 @@ size_t SkiplistIndex::elementSize () const {
////////////////////////////////////////////////////////////////////////////////
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 != rightElement);
@ -841,8 +841,8 @@ int SkiplistIndex::KeyElementComparator::operator() (TRI_skiplist_index_key_t co
////////////////////////////////////////////////////////////////////////////////
int SkiplistIndex::ElementElementComparator::operator() (TRI_index_element_t const* leftElement,
TRI_index_element_t const* rightElement,
triagens::basics::SkipListCmpType cmptype) {
TRI_index_element_t const* rightElement,
triagens::basics::SkipListCmpType cmptype) const {
TRI_ASSERT(nullptr != leftElement);
TRI_ASSERT(nullptr != rightElement);

View File

@ -81,7 +81,8 @@ namespace triagens {
SkiplistIteratorInterval ()
: _leftEndPoint(nullptr),
_rightEndPoint(nullptr) { }
_rightEndPoint(nullptr) {
}
};
// -----------------------------------------------------------------------------
@ -90,7 +91,7 @@ namespace triagens {
private:
SkiplistIndex* const _index;
SkiplistIndex const* _index;
size_t _currentInterval; // starts with 0, current interval used
bool _reverse;
Node* _cursor;
@ -102,16 +103,16 @@ namespace triagens {
public:
SkiplistIterator (
SkiplistIndex* const idx,
bool reverse
) : _index(idx) ,
SkiplistIterator (SkiplistIndex const* idx,
bool reverse)
: _index(idx) ,
_currentInterval(0),
_reverse(reverse),
_cursor(nullptr) {
}
~SkiplistIterator () {}
~SkiplistIterator () {
}
// always holds the last node returned, initially equal to
// the _leftEndPoint of the first interval (or the
@ -131,9 +132,9 @@ namespace triagens {
public:
size_t size ();
size_t size () const;
bool hasNext ();
bool hasNext () const;
TRI_index_element_t* next ();
@ -150,10 +151,10 @@ namespace triagens {
private:
bool hasPrevIteration ();
bool hasPrevIteration () const;
TRI_index_element_t* prevIteration ();
bool hasNextIteration ();
bool hasNextIteration () const;
TRI_index_element_t* nextIteration ();
bool findHelperIntervalIntersectionValid (
@ -162,9 +163,7 @@ namespace triagens {
SkiplistIteratorInterval& interval
);
bool findHelperIntervalValid (
SkiplistIteratorInterval const& interval
);
bool findHelperIntervalValid (SkiplistIteratorInterval const& interval);
};
// -----------------------------------------------------------------------------
@ -175,7 +174,7 @@ namespace triagens {
struct KeyElementComparator {
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) {
_idx = idx;
@ -189,7 +188,7 @@ namespace triagens {
struct ElementElementComparator {
int operator() (TRI_index_element_t const* leftElement,
TRI_index_element_t const* rightElement,
triagens::basics::SkipListCmpType cmptype);
triagens::basics::SkipListCmpType cmptype) const;
ElementElementComparator (SkiplistIndex* idx) {
_idx = idx;

View File

@ -245,7 +245,7 @@ namespace triagens {
/// @brief return the successor node or nullptr if last node
////////////////////////////////////////////////////////////////////////////////
Node* nextNode (Node* node) {
Node* nextNode (Node* node) const {
return node->_next[0];
}