/Users/deen/code/yugabyte-db/src/yb/rocksdb/table/scoped_arena_iterator.h
Line | Count | Source |
1 | | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | | // This source code is licensed under the BSD-style license found in the |
3 | | // LICENSE file in the root directory of this source tree. An additional grant |
4 | | // of patent rights can be found in the PATENTS file in the same directory. |
5 | | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. |
6 | | // Use of this source code is governed by a BSD-style license that can be |
7 | | // found in the LICENSE file. See the AUTHORS file for names of contributors. |
8 | | // |
9 | | // The following only applies to changes made to this file as part of YugaByte development. |
10 | | // |
11 | | // Portions Copyright (c) YugaByte, Inc. |
12 | | // |
13 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
14 | | // in compliance with the License. You may obtain a copy of the License at |
15 | | // |
16 | | // http://www.apache.org/licenses/LICENSE-2.0 |
17 | | // |
18 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
19 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
20 | | // or implied. See the License for the specific language governing permissions and limitations |
21 | | // under the License. |
22 | | // |
23 | | #pragma once |
24 | | |
25 | | #include "yb/rocksdb/table/internal_iterator.h" |
26 | | |
27 | | namespace rocksdb { |
28 | | class ScopedArenaIterator { |
29 | | public: |
30 | | explicit ScopedArenaIterator(InternalIterator* iter = nullptr) |
31 | 39.0k | : iter_(iter) {} |
32 | | |
33 | 345k | InternalIterator* operator->() { return iter_; } |
34 | | |
35 | 401 | void set(InternalIterator* iter) { iter_ = iter; } |
36 | | |
37 | 28.7k | InternalIterator* get() { return iter_; } |
38 | | |
39 | 38.9k | ~ScopedArenaIterator() { iter_->~InternalIterator(); } |
40 | | |
41 | | private: |
42 | | InternalIterator* iter_; |
43 | | }; |
44 | | } // namespace rocksdb |