/src/duckdb/third_party/skiplist/SkipList.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | // |
2 | | // SkipList.cpp |
3 | | // SkipList |
4 | | // |
5 | | // Created by Paul Ross on 19/12/2015. |
6 | | // Copyright (c) 2017 Paul Ross. All rights reserved. |
7 | | // |
8 | | |
9 | | #include <cstdlib> |
10 | | #ifdef SKIPLIST_THREAD_SUPPORT |
11 | | #include <mutex> |
12 | | #endif |
13 | | #include <string> |
14 | | |
15 | | #include "SkipList.h" |
16 | | |
17 | | namespace duckdb_skiplistlib { |
18 | | namespace skip_list { |
19 | | |
20 | | // This throws an IndexError when the index value >= size. |
21 | | // If possible the error will have an informative message. |
22 | | #ifdef INCLUDE_METHODS_THAT_USE_STREAMS |
23 | | void _throw_exceeds_size(size_t index) { |
24 | | std::ostringstream oss; |
25 | | oss << "Index out of range 0 <= index < " << index; |
26 | | std::string err_msg = oss.str(); |
27 | | #else |
28 | 0 | void _throw_exceeds_size(size_t /* index */) { |
29 | 0 | std::string err_msg = "Index out of range."; |
30 | 0 | #endif |
31 | 0 | throw IndexError(err_msg); |
32 | 0 | } |
33 | | |
34 | | #ifdef SKIPLIST_THREAD_SUPPORT |
35 | | std::mutex gSkipListMutex; |
36 | | #endif |
37 | | |
38 | | |
39 | | } // namespace SkipList |
40 | | } // namespace OrderedStructs |