/src/CMake/Source/cmLinkedTree.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <cassert> |
8 | | #include <vector> |
9 | | |
10 | | /** |
11 | | @brief A adaptor for traversing a tree structure in a vector |
12 | | |
13 | | This class is not intended to be wholly generic like a standard library |
14 | | container adaptor. Mostly it exists to facilitate code sharing for the |
15 | | needs of the cmState. For example, the Truncate() method is a specific |
16 | | requirement of the cmState. |
17 | | |
18 | | An empty cmLinkedTree provides a Root() method, and an Push() method, |
19 | | each of which return iterators. A Tree can be built up by extending |
20 | | from the root, and then extending from any other iterator. |
21 | | |
22 | | An iterator resulting from this tree construction can be |
23 | | forward-only-iterated toward the root. Extending the tree never |
24 | | invalidates existing iterators. |
25 | | */ |
26 | | template <typename T> |
27 | | class cmLinkedTree |
28 | | { |
29 | | using PositionType = typename std::vector<T>::size_type; |
30 | | using PointerType = T*; |
31 | | using ReferenceType = T&; |
32 | | |
33 | | public: |
34 | | class iterator |
35 | | { |
36 | | friend class cmLinkedTree; |
37 | | cmLinkedTree* Tree; |
38 | | |
39 | | // The Position is always 'one past the end'. |
40 | | PositionType Position; |
41 | | |
42 | | iterator(cmLinkedTree* tree, PositionType pos) |
43 | 5.61M | : Tree(tree) |
44 | 5.61M | , Position(pos) |
45 | 5.61M | { |
46 | 5.61M | } cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::iterator(cmLinkedTree<cmStateDetail::SnapshotDataType>*, unsigned long) Line | Count | Source | 43 | 5.26M | : Tree(tree) | 44 | 5.26M | , Position(pos) | 45 | 5.26M | { | 46 | 5.26M | } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator::iterator(cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >*, unsigned long) Line | Count | Source | 43 | 51.7k | : Tree(tree) | 44 | 51.7k | , Position(pos) | 45 | 51.7k | { | 46 | 51.7k | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator::iterator(cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>*, unsigned long) Line | Count | Source | 43 | 39.8k | : Tree(tree) | 44 | 39.8k | , Position(pos) | 45 | 39.8k | { | 46 | 39.8k | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::iterator(cmLinkedTree<cmStateDetail::PolicyStackEntry>*, unsigned long) Line | Count | Source | 43 | 79.6k | : Tree(tree) | 44 | 79.6k | , Position(pos) | 45 | 79.6k | { | 46 | 79.6k | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::iterator(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>*, unsigned long) Line | Count | Source | 43 | 99.6k | : Tree(tree) | 44 | 99.6k | , Position(pos) | 45 | 99.6k | { | 46 | 99.6k | } |
cmLinkedTree<cmDefinitions>::iterator::iterator(cmLinkedTree<cmDefinitions>*, unsigned long) Line | Count | Source | 43 | 79.7k | : Tree(tree) | 44 | 79.7k | , Position(pos) | 45 | 79.7k | { | 46 | 79.7k | } |
|
47 | | |
48 | | public: |
49 | | iterator() |
50 | 310k | : Tree(nullptr) |
51 | 310k | , Position(0) |
52 | 310k | { |
53 | 310k | } cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::iterator() Line | Count | Source | 50 | 91.6k | : Tree(nullptr) | 51 | 91.6k | , Position(0) | 52 | 91.6k | { | 53 | 91.6k | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::iterator() Line | Count | Source | 50 | 59.7k | : Tree(nullptr) | 51 | 59.7k | , Position(0) | 52 | 59.7k | { | 53 | 59.7k | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::iterator() Line | Count | Source | 50 | 59.7k | : Tree(nullptr) | 51 | 59.7k | , Position(0) | 52 | 59.7k | { | 53 | 59.7k | } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator::iterator() Line | Count | Source | 50 | 19.9k | : Tree(nullptr) | 51 | 19.9k | , Position(0) | 52 | 19.9k | { | 53 | 19.9k | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator::iterator() Line | Count | Source | 50 | 19.9k | : Tree(nullptr) | 51 | 19.9k | , Position(0) | 52 | 19.9k | { | 53 | 19.9k | } |
cmLinkedTree<cmDefinitions>::iterator::iterator() Line | Count | Source | 50 | 59.7k | : Tree(nullptr) | 51 | 59.7k | , Position(0) | 52 | 59.7k | { | 53 | 59.7k | } |
|
54 | | |
55 | | void operator++() |
56 | 13.7M | { |
57 | 13.7M | assert(this->Tree); |
58 | 13.7M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
59 | 13.7M | assert(this->Position <= this->Tree->Data.size()); |
60 | 13.7M | assert(this->Position > 0); |
61 | 13.7M | this->Position = this->Tree->UpPositions[this->Position - 1]; |
62 | 13.7M | } cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::operator++() Line | Count | Source | 56 | 11.8k | { | 57 | 11.8k | assert(this->Tree); | 58 | 11.8k | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 59 | 11.8k | assert(this->Position <= this->Tree->Data.size()); | 60 | | assert(this->Position > 0); | 61 | 11.8k | this->Position = this->Tree->UpPositions[this->Position - 1]; | 62 | 11.8k | } |
cmLinkedTree<cmDefinitions>::iterator::operator++() Line | Count | Source | 56 | 5.94M | { | 57 | 5.94M | assert(this->Tree); | 58 | 5.94M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 59 | 5.94M | assert(this->Position <= this->Tree->Data.size()); | 60 | | assert(this->Position > 0); | 61 | 5.94M | this->Position = this->Tree->UpPositions[this->Position - 1]; | 62 | 5.94M | } |
Unexecuted instantiation: cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator::operator++() cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::operator++() Line | Count | Source | 56 | 7.77M | { | 57 | 7.77M | assert(this->Tree); | 58 | 7.77M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 59 | 7.77M | assert(this->Position <= this->Tree->Data.size()); | 60 | | assert(this->Position > 0); | 61 | 7.77M | this->Position = this->Tree->UpPositions[this->Position - 1]; | 62 | 7.77M | } |
Unexecuted instantiation: cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::operator++() |
63 | | |
64 | | PointerType operator->() const |
65 | 28.2M | { |
66 | 28.2M | assert(this->Tree); |
67 | 28.2M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
68 | 28.2M | assert(this->Position <= this->Tree->Data.size()); |
69 | 28.2M | assert(this->Position > 0); |
70 | 28.2M | return this->Tree->GetPointer(this->Position - 1); |
71 | 28.2M | } cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::operator->() const Line | Count | Source | 65 | 28.0M | { | 66 | 28.0M | assert(this->Tree); | 67 | 28.0M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 68 | 28.0M | assert(this->Position <= this->Tree->Data.size()); | 69 | | assert(this->Position > 0); | 70 | 28.0M | return this->Tree->GetPointer(this->Position - 1); | 71 | 28.0M | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator::operator->() const Line | Count | Source | 65 | 261k | { | 66 | 261k | assert(this->Tree); | 67 | 261k | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 68 | 261k | assert(this->Position <= this->Tree->Data.size()); | 69 | | assert(this->Position > 0); | 70 | 261k | return this->Tree->GetPointer(this->Position - 1); | 71 | 261k | } |
|
72 | | |
73 | | PointerType operator->() |
74 | 115M | { |
75 | 115M | assert(this->Tree); |
76 | 115M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
77 | 115M | assert(this->Position <= this->Tree->Data.size()); |
78 | 115M | assert(this->Position > 0); |
79 | 115M | return this->Tree->GetPointer(this->Position - 1); |
80 | 115M | } cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator::operator->() Line | Count | Source | 74 | 33.4M | { | 75 | 33.4M | assert(this->Tree); | 76 | 33.4M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 77 | 33.4M | assert(this->Position <= this->Tree->Data.size()); | 78 | | assert(this->Position > 0); | 79 | 33.4M | return this->Tree->GetPointer(this->Position - 1); | 80 | 33.4M | } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::operator->() Line | Count | Source | 74 | 39.8M | { | 75 | 39.8M | assert(this->Tree); | 76 | 39.8M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 77 | 39.8M | assert(this->Position <= this->Tree->Data.size()); | 78 | | assert(this->Position > 0); | 79 | 39.8M | return this->Tree->GetPointer(this->Position - 1); | 80 | 39.8M | } |
cmLinkedTree<cmDefinitions>::iterator::operator->() Line | Count | Source | 74 | 13.3M | { | 75 | 13.3M | assert(this->Tree); | 76 | 13.3M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 77 | 13.3M | assert(this->Position <= this->Tree->Data.size()); | 78 | | assert(this->Position > 0); | 79 | 13.3M | return this->Tree->GetPointer(this->Position - 1); | 80 | 13.3M | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::operator->() Line | Count | Source | 74 | 28.3M | { | 75 | 28.3M | assert(this->Tree); | 76 | 28.3M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 77 | 28.3M | assert(this->Position <= this->Tree->Data.size()); | 78 | | assert(this->Position > 0); | 79 | 28.3M | return this->Tree->GetPointer(this->Position - 1); | 80 | 28.3M | } |
Unexecuted instantiation: cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::operator->() |
81 | | |
82 | | ReferenceType operator*() const |
83 | 31.7k | { |
84 | 31.7k | assert(this->Tree); |
85 | 31.7k | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
86 | 31.7k | assert(this->Position <= this->Tree->Data.size()); |
87 | 31.7k | assert(this->Position > 0); |
88 | 31.7k | return this->Tree->GetReference(this->Position - 1); |
89 | 31.7k | } |
90 | | |
91 | | ReferenceType operator*() |
92 | 403k | { |
93 | 403k | assert(this->Tree); |
94 | 403k | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
95 | 403k | assert(this->Position <= this->Tree->Data.size()); |
96 | 403k | assert(this->Position > 0); |
97 | 403k | return this->Tree->GetReference(this->Position - 1); |
98 | 403k | } cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::operator*() Line | Count | Source | 92 | 1 | { | 93 | 1 | assert(this->Tree); | 94 | 1 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 95 | 1 | assert(this->Position <= this->Tree->Data.size()); | 96 | | assert(this->Position > 0); | 97 | 1 | return this->Tree->GetReference(this->Position - 1); | 98 | 1 | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator::operator*() Line | Count | Source | 92 | 1 | { | 93 | 1 | assert(this->Tree); | 94 | 1 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 95 | 1 | assert(this->Position <= this->Tree->Data.size()); | 96 | | assert(this->Position > 0); | 97 | 1 | return this->Tree->GetReference(this->Position - 1); | 98 | 1 | } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator::operator*() Line | Count | Source | 92 | 403k | { | 93 | 403k | assert(this->Tree); | 94 | 403k | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 95 | 403k | assert(this->Position <= this->Tree->Data.size()); | 96 | | assert(this->Position > 0); | 97 | 403k | return this->Tree->GetReference(this->Position - 1); | 98 | 403k | } |
Unexecuted instantiation: cmLinkedTree<cmDefinitions>::iterator::operator*() |
99 | | |
100 | | bool operator==(iterator other) const |
101 | 32.9M | { |
102 | 32.9M | assert(this->Tree); |
103 | 32.9M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
104 | 32.9M | assert(this->Tree == other.Tree); |
105 | 32.9M | return this->Position == other.Position; |
106 | 32.9M | } cmLinkedTree<cmDefinitions>::iterator::operator==(cmLinkedTree<cmDefinitions>::iterator) const Line | Count | Source | 101 | 5.94M | { | 102 | 5.94M | assert(this->Tree); | 103 | 5.94M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 104 | | assert(this->Tree == other.Tree); | 105 | 5.94M | return this->Position == other.Position; | 106 | 5.94M | } |
Unexecuted instantiation: cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator::operator==(cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator) const cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::operator==(cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator) const Line | Count | Source | 101 | 5.15M | { | 102 | 5.15M | assert(this->Tree); | 103 | 5.15M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 104 | | assert(this->Tree == other.Tree); | 105 | 5.15M | return this->Position == other.Position; | 106 | 5.15M | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::operator==(cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator) const Line | Count | Source | 101 | 21.8M | { | 102 | 21.8M | assert(this->Tree); | 103 | 21.8M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 104 | | assert(this->Tree == other.Tree); | 105 | 21.8M | return this->Position == other.Position; | 106 | 21.8M | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::operator==(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator) const Line | Count | Source | 101 | 11.8k | { | 102 | 11.8k | assert(this->Tree); | 103 | 11.8k | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 104 | | assert(this->Tree == other.Tree); | 105 | 11.8k | return this->Position == other.Position; | 106 | 11.8k | } |
|
107 | | |
108 | | bool operator!=(iterator other) const |
109 | 21.8M | { |
110 | 21.8M | assert(this->Tree); |
111 | 21.8M | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
112 | 21.8M | return !(*this == other); |
113 | 21.8M | } Unexecuted instantiation: cmLinkedTree<cmDefinitions>::iterator::operator!=(cmLinkedTree<cmDefinitions>::iterator) const Unexecuted instantiation: cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator::operator!=(cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator) const cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::operator!=(cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator) const Line | Count | Source | 109 | 51.8k | { | 110 | 51.8k | assert(this->Tree); | 111 | | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 112 | 51.8k | return !(*this == other); | 113 | 51.8k | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::operator!=(cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator) const Line | Count | Source | 109 | 21.8M | { | 110 | 21.8M | assert(this->Tree); | 111 | | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 112 | 21.8M | return !(*this == other); | 113 | 21.8M | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::operator!=(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator) const Line | Count | Source | 109 | 11.8k | { | 110 | 11.8k | assert(this->Tree); | 111 | | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 112 | 11.8k | return !(*this == other); | 113 | 11.8k | } |
|
114 | | |
115 | | bool IsValid() const |
116 | 39.8k | { |
117 | 39.8k | if (!this->Tree) { |
118 | 0 | return false; |
119 | 0 | } |
120 | 39.8k | return this->Position <= this->Tree->Data.size(); |
121 | 39.8k | } |
122 | | |
123 | | bool StrictWeakOrdered(iterator other) const |
124 | 0 | { |
125 | 0 | assert(this->Tree); |
126 | 0 | assert(this->Tree == other.Tree); |
127 | 0 | return this->Position < other.Position; |
128 | 0 | } |
129 | | }; |
130 | | |
131 | | iterator Root() const |
132 | 5.42M | { |
133 | 5.42M | return iterator(const_cast<cmLinkedTree*>(this), 0); |
134 | 5.42M | } cmLinkedTree<cmStateDetail::PolicyStackEntry>::Root() const Line | Count | Source | 132 | 59.7k | { | 133 | 59.7k | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 59.7k | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::Root() const Line | Count | Source | 132 | 59.7k | { | 133 | 59.7k | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 59.7k | } |
cmLinkedTree<cmDefinitions>::Root() const Line | Count | Source | 132 | 59.7k | { | 133 | 59.7k | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 59.7k | } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::Root() const Line | Count | Source | 132 | 5.21M | { | 133 | 5.21M | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 5.21M | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::Root() const Line | Count | Source | 132 | 19.9k | { | 133 | 19.9k | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 19.9k | } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Root() const Line | Count | Source | 132 | 19.9k | { | 133 | 19.9k | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 19.9k | } |
|
135 | | |
136 | 79.7k | iterator Push(iterator it) { return this->Push_impl(it, T()); }cmLinkedTree<cmDefinitions>::Push(cmLinkedTree<cmDefinitions>::iterator) Line | Count | Source | 136 | 19.9k | iterator Push(iterator it) { return this->Push_impl(it, T()); } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::Push(cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator) Line | Count | Source | 136 | 19.9k | iterator Push(iterator it) { return this->Push_impl(it, T()); } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::Push(cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator) Line | Count | Source | 136 | 19.9k | iterator Push(iterator it) { return this->Push_impl(it, T()); } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Push(cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator) Line | Count | Source | 136 | 19.9k | iterator Push(iterator it) { return this->Push_impl(it, T()); } |
|
137 | | |
138 | 103k | iterator Push(iterator it, T t) { return this->Push_impl(it, std::move(t)); }cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::Push(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator, cmStateDetail::DiagnosticStackEntry) Line | Count | Source | 138 | 39.8k | iterator Push(iterator it, T t) { return this->Push_impl(it, std::move(t)); } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::Push(cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator, cmStateDetail::SnapshotDataType) Line | Count | Source | 138 | 31.7k | iterator Push(iterator it, T t) { return this->Push_impl(it, std::move(t)); } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Push(cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) Line | Count | Source | 138 | 11.8k | iterator Push(iterator it, T t) { return this->Push_impl(it, std::move(t)); } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::Push(cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator, cmStateDetail::PolicyStackEntry) Line | Count | Source | 138 | 19.8k | iterator Push(iterator it, T t) { return this->Push_impl(it, std::move(t)); } |
|
139 | | |
140 | 0 | bool IsLast(iterator it) { return it.Position == this->Data.size(); }Unexecuted instantiation: cmLinkedTree<cmStateDetail::SnapshotDataType>::IsLast(cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator) Unexecuted instantiation: cmLinkedTree<cmDefinitions>::IsLast(cmLinkedTree<cmDefinitions>::iterator) Unexecuted instantiation: cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::IsLast(cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator) Unexecuted instantiation: cmLinkedTree<cmStateDetail::PolicyStackEntry>::IsLast(cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator) Unexecuted instantiation: cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::IsLast(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator) |
141 | | |
142 | | iterator Pop(iterator it) |
143 | 0 | { |
144 | 0 | assert(!this->Data.empty()); |
145 | 0 | assert(this->UpPositions.size() == this->Data.size()); |
146 | 0 | bool const isLast = this->IsLast(it); |
147 | 0 | ++it; |
148 | | // If this is the last entry then no other entry can refer |
149 | | // to it so we can drop its storage. |
150 | 0 | if (isLast) { |
151 | 0 | this->Data.pop_back(); |
152 | 0 | this->UpPositions.pop_back(); |
153 | 0 | } |
154 | 0 | return it; |
155 | 0 | } Unexecuted instantiation: cmLinkedTree<cmDefinitions>::Pop(cmLinkedTree<cmDefinitions>::iterator) Unexecuted instantiation: cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Pop(cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator) Unexecuted instantiation: cmLinkedTree<cmStateDetail::SnapshotDataType>::Pop(cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator) Unexecuted instantiation: cmLinkedTree<cmStateDetail::PolicyStackEntry>::Pop(cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator) Unexecuted instantiation: cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::Pop(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator) |
156 | | |
157 | | iterator Truncate() |
158 | 3 | { |
159 | 3 | assert(!this->UpPositions.empty()); |
160 | 3 | this->UpPositions.erase(this->UpPositions.begin() + 1, |
161 | 3 | this->UpPositions.end()); |
162 | 3 | assert(!this->Data.empty()); |
163 | 3 | this->Data.erase(this->Data.begin() + 1, this->Data.end()); |
164 | 3 | return iterator(this, 1); |
165 | 3 | } cmLinkedTree<cmStateDetail::SnapshotDataType>::Truncate() Line | Count | Source | 158 | 1 | { | 159 | 1 | assert(!this->UpPositions.empty()); | 160 | 1 | this->UpPositions.erase(this->UpPositions.begin() + 1, | 161 | 1 | this->UpPositions.end()); | 162 | | assert(!this->Data.empty()); | 163 | 1 | this->Data.erase(this->Data.begin() + 1, this->Data.end()); | 164 | 1 | return iterator(this, 1); | 165 | 1 | } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Truncate() Line | Count | Source | 158 | 1 | { | 159 | 1 | assert(!this->UpPositions.empty()); | 160 | 1 | this->UpPositions.erase(this->UpPositions.begin() + 1, | 161 | 1 | this->UpPositions.end()); | 162 | | assert(!this->Data.empty()); | 163 | 1 | this->Data.erase(this->Data.begin() + 1, this->Data.end()); | 164 | 1 | return iterator(this, 1); | 165 | 1 | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::Truncate() Line | Count | Source | 158 | 1 | { | 159 | 1 | assert(!this->UpPositions.empty()); | 160 | 1 | this->UpPositions.erase(this->UpPositions.begin() + 1, | 161 | 1 | this->UpPositions.end()); | 162 | | assert(!this->Data.empty()); | 163 | 1 | this->Data.erase(this->Data.begin() + 1, this->Data.end()); | 164 | 1 | return iterator(this, 1); | 165 | 1 | } |
|
166 | | |
167 | | void Clear() |
168 | 3 | { |
169 | 3 | this->UpPositions.clear(); |
170 | 3 | this->Data.clear(); |
171 | 3 | } cmLinkedTree<cmStateDetail::PolicyStackEntry>::Clear() Line | Count | Source | 168 | 1 | { | 169 | 1 | this->UpPositions.clear(); | 170 | 1 | this->Data.clear(); | 171 | 1 | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::Clear() Line | Count | Source | 168 | 1 | { | 169 | 1 | this->UpPositions.clear(); | 170 | 1 | this->Data.clear(); | 171 | 1 | } |
cmLinkedTree<cmDefinitions>::Clear() Line | Count | Source | 168 | 1 | { | 169 | 1 | this->UpPositions.clear(); | 170 | 1 | this->Data.clear(); | 171 | 1 | } |
|
172 | | |
173 | | private: |
174 | 434k | T& GetReference(PositionType pos) { return this->Data[pos]; }cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::GetReference(unsigned long) Line | Count | Source | 174 | 1 | T& GetReference(PositionType pos) { return this->Data[pos]; } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::GetReference(unsigned long) Line | Count | Source | 174 | 1 | T& GetReference(PositionType pos) { return this->Data[pos]; } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::GetReference(unsigned long) Line | Count | Source | 174 | 31.7k | T& GetReference(PositionType pos) { return this->Data[pos]; } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::GetReference(unsigned long) Line | Count | Source | 174 | 403k | T& GetReference(PositionType pos) { return this->Data[pos]; } |
Unexecuted instantiation: cmLinkedTree<cmDefinitions>::GetReference(unsigned long) |
175 | | |
176 | 143M | T* GetPointer(PositionType pos) { return &this->Data[pos]; }cmLinkedTree<cmStateDetail::SnapshotDataType>::GetPointer(unsigned long) Line | Count | Source | 176 | 67.8M | T* GetPointer(PositionType pos) { return &this->Data[pos]; } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::GetPointer(unsigned long) Line | Count | Source | 176 | 33.7M | T* GetPointer(PositionType pos) { return &this->Data[pos]; } |
cmLinkedTree<cmDefinitions>::GetPointer(unsigned long) Line | Count | Source | 176 | 13.3M | T* GetPointer(PositionType pos) { return &this->Data[pos]; } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::GetPointer(unsigned long) Line | Count | Source | 176 | 28.3M | T* GetPointer(PositionType pos) { return &this->Data[pos]; } |
Unexecuted instantiation: cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::GetPointer(unsigned long) |
177 | | |
178 | | iterator Push_impl(iterator it, T&& t) |
179 | 183k | { |
180 | 183k | assert(this->UpPositions.size() == this->Data.size()); |
181 | | assert(it.Position <= this->UpPositions.size()); |
182 | 183k | this->UpPositions.push_back(it.Position); |
183 | 183k | this->Data.push_back(std::move(t)); |
184 | 183k | return iterator(this, this->UpPositions.size()); |
185 | 183k | } cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::Push_impl(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator, cmStateDetail::DiagnosticStackEntry&&) Line | Count | Source | 179 | 39.8k | { | 180 | 39.8k | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 39.8k | this->UpPositions.push_back(it.Position); | 183 | 39.8k | this->Data.push_back(std::move(t)); | 184 | 39.8k | return iterator(this, this->UpPositions.size()); | 185 | 39.8k | } |
cmLinkedTree<cmDefinitions>::Push_impl(cmLinkedTree<cmDefinitions>::iterator, cmDefinitions&&) Line | Count | Source | 179 | 19.9k | { | 180 | 19.9k | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 19.9k | this->UpPositions.push_back(it.Position); | 183 | 19.9k | this->Data.push_back(std::move(t)); | 184 | 19.9k | return iterator(this, this->UpPositions.size()); | 185 | 19.9k | } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::Push_impl(cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator, cmStateDetail::SnapshotDataType&&) Line | Count | Source | 179 | 51.6k | { | 180 | 51.6k | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 51.6k | this->UpPositions.push_back(it.Position); | 183 | 51.6k | this->Data.push_back(std::move(t)); | 184 | 51.6k | return iterator(this, this->UpPositions.size()); | 185 | 51.6k | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::Push_impl(cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator, cmStateDetail::BuildsystemDirectoryStateType&&) Line | Count | Source | 179 | 19.9k | { | 180 | 19.9k | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 19.9k | this->UpPositions.push_back(it.Position); | 183 | 19.9k | this->Data.push_back(std::move(t)); | 184 | 19.9k | return iterator(this, this->UpPositions.size()); | 185 | 19.9k | } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Push_impl(cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) Line | Count | Source | 179 | 31.7k | { | 180 | 31.7k | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 31.7k | this->UpPositions.push_back(it.Position); | 183 | 31.7k | this->Data.push_back(std::move(t)); | 184 | 31.7k | return iterator(this, this->UpPositions.size()); | 185 | 31.7k | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::Push_impl(cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator, cmStateDetail::PolicyStackEntry&&) Line | Count | Source | 179 | 19.8k | { | 180 | 19.8k | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 19.8k | this->UpPositions.push_back(it.Position); | 183 | 19.8k | this->Data.push_back(std::move(t)); | 184 | 19.8k | return iterator(this, this->UpPositions.size()); | 185 | 19.8k | } |
|
186 | | |
187 | | std::vector<T> Data; |
188 | | std::vector<PositionType> UpPositions; |
189 | | }; |