1d3a497a2SManu Dhundi/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2d3a497a2SManu Dhundi/*
3d3a497a2SManu Dhundi *     Copyright 2017 Couchbase, Inc
4d3a497a2SManu Dhundi *
5d3a497a2SManu Dhundi *   Licensed under the Apache License, Version 2.0 (the "License");
6d3a497a2SManu Dhundi *   you may not use this file except in compliance with the License.
7d3a497a2SManu Dhundi *   You may obtain a copy of the License at
8d3a497a2SManu Dhundi *
9d3a497a2SManu Dhundi *       http://www.apache.org/licenses/LICENSE-2.0
10d3a497a2SManu Dhundi *
11d3a497a2SManu Dhundi *   Unless required by applicable law or agreed to in writing, software
12d3a497a2SManu Dhundi *   distributed under the License is distributed on an "AS IS" BASIS,
13d3a497a2SManu Dhundi *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14d3a497a2SManu Dhundi *   See the License for the specific language governing permissions and
15d3a497a2SManu Dhundi *   limitations under the License.
16d3a497a2SManu Dhundi */
17d3a497a2SManu Dhundi
18d3a497a2SManu Dhundi#include <mutex>
19d3a497a2SManu Dhundi#include "linked_list.h"
20d3a497a2SManu Dhundi
21d3a497a2SManu DhundiSequenceList::RangeIterator::RangeIterator(
22d3a497a2SManu Dhundi        std::unique_ptr<RangeIteratorImpl> rangeIterImpl)
23d3a497a2SManu Dhundi    : rangeIterImpl(std::move(rangeIterImpl)) {
24d3a497a2SManu Dhundi}
25d3a497a2SManu Dhundi
2634688619SJames Harrisonconst OrderedStoredValue& SequenceList::RangeIterator::operator*() const {
27d3a497a2SManu Dhundi    return *(*rangeIterImpl);
28d3a497a2SManu Dhundi}
29d3a497a2SManu Dhundi
3034688619SJames Harrisonconst OrderedStoredValue* SequenceList::RangeIterator::operator->() const {
3134688619SJames Harrison    return &*(*rangeIterImpl);
3234688619SJames Harrison}
3334688619SJames Harrison
34d3a497a2SManu DhundiSequenceList::RangeIterator& SequenceList::RangeIterator::operator++() {
35d3a497a2SManu Dhundi    ++(*rangeIterImpl);
36d3a497a2SManu Dhundi    return *this;
37d3a497a2SManu Dhundi}
38d3a497a2SManu Dhundi
3961b5ad4fSManu Dhundiseqno_t SequenceList::RangeIterator::curr() const {
40d3a497a2SManu Dhundi    return rangeIterImpl->curr();
41d3a497a2SManu Dhundi}
42d3a497a2SManu Dhundi
4361b5ad4fSManu Dhundiseqno_t SequenceList::RangeIterator::end() const {
44d3a497a2SManu Dhundi    return rangeIterImpl->end();
45d3a497a2SManu Dhundi}
4661b5ad4fSManu Dhundi
4761b5ad4fSManu Dhundiseqno_t SequenceList::RangeIterator::back() const {
4861b5ad4fSManu Dhundi    return rangeIterImpl->back();
4961b5ad4fSManu Dhundi}
5061b5ad4fSManu Dhundi
5161b5ad4fSManu Dhundiuint64_t SequenceList::RangeIterator::count() const {
5261b5ad4fSManu Dhundi    return rangeIterImpl->count();
5361b5ad4fSManu Dhundi}
5461b5ad4fSManu Dhundi
5561b5ad4fSManu Dhundiseqno_t SequenceList::RangeIterator::getEarlySnapShotEnd() const {
5661b5ad4fSManu Dhundi    return rangeIterImpl->getEarlySnapShotEnd();
5761b5ad4fSManu Dhundi}
58d1bddedcSPaolo Cocchi
59d1bddedcSPaolo Cocchiuint64_t SequenceList::RangeIterator::getMaxVisibleSeqno() const {
60d1bddedcSPaolo Cocchi    return rangeIterImpl->getMaxVisibleSeqno();
61d1bddedcSPaolo Cocchi}