/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 | 504 | : Tree(tree) |
44 | 504 | , Position(pos) |
45 | 504 | { |
46 | 504 | } cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::iterator(cmLinkedTree<cmStateDetail::SnapshotDataType>*, unsigned long) Line | Count | Source | 43 | 143 | : Tree(tree) | 44 | 143 | , Position(pos) | 45 | 143 | { | 46 | 143 | } |
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 | 48 | : Tree(tree) | 44 | 48 | , Position(pos) | 45 | 48 | { | 46 | 48 | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator::iterator(cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>*, unsigned long) Line | Count | Source | 43 | 47 | : Tree(tree) | 44 | 47 | , Position(pos) | 45 | 47 | { | 46 | 47 | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::iterator(cmLinkedTree<cmStateDetail::PolicyStackEntry>*, unsigned long) Line | Count | Source | 43 | 73 | : Tree(tree) | 44 | 73 | , Position(pos) | 45 | 73 | { | 46 | 73 | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::iterator(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>*, unsigned long) Line | Count | Source | 43 | 97 | : Tree(tree) | 44 | 97 | , Position(pos) | 45 | 97 | { | 46 | 97 | } |
cmLinkedTree<cmDefinitions>::iterator::iterator(cmLinkedTree<cmDefinitions>*, unsigned long) Line | Count | Source | 43 | 96 | : Tree(tree) | 44 | 96 | , Position(pos) | 45 | 96 | { | 46 | 96 | } |
|
47 | | |
48 | | public: |
49 | | iterator() |
50 | 346 | : Tree(nullptr) |
51 | 346 | , Position(0) |
52 | 346 | { |
53 | 346 | } cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::iterator() Line | Count | Source | 50 | 93 | : Tree(nullptr) | 51 | 93 | , Position(0) | 52 | 93 | { | 53 | 93 | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::iterator() Line | Count | Source | 50 | 69 | : Tree(nullptr) | 51 | 69 | , Position(0) | 52 | 69 | { | 53 | 69 | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::iterator() Line | Count | Source | 50 | 69 | : Tree(nullptr) | 51 | 69 | , Position(0) | 52 | 69 | { | 53 | 69 | } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator::iterator() Line | Count | Source | 50 | 23 | : Tree(nullptr) | 51 | 23 | , Position(0) | 52 | 23 | { | 53 | 23 | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator::iterator() Line | Count | Source | 50 | 23 | : Tree(nullptr) | 51 | 23 | , Position(0) | 52 | 23 | { | 53 | 23 | } |
cmLinkedTree<cmDefinitions>::iterator::iterator() Line | Count | Source | 50 | 69 | : Tree(nullptr) | 51 | 69 | , Position(0) | 52 | 69 | { | 53 | 69 | } |
|
54 | | |
55 | | void operator++() |
56 | 3 | { |
57 | 3 | assert(this->Tree); |
58 | 3 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
59 | 3 | assert(this->Position <= this->Tree->Data.size()); |
60 | 3 | assert(this->Position > 0); |
61 | 3 | this->Position = this->Tree->UpPositions[this->Position - 1]; |
62 | 3 | } cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::operator++() Line | Count | Source | 56 | 1 | { | 57 | 1 | assert(this->Tree); | 58 | 1 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 59 | 1 | assert(this->Position <= this->Tree->Data.size()); | 60 | | assert(this->Position > 0); | 61 | 1 | this->Position = this->Tree->UpPositions[this->Position - 1]; | 62 | 1 | } |
cmLinkedTree<cmDefinitions>::iterator::operator++() Line | Count | Source | 56 | 2 | { | 57 | 2 | assert(this->Tree); | 58 | 2 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 59 | 2 | assert(this->Position <= this->Tree->Data.size()); | 60 | | assert(this->Position > 0); | 61 | 2 | this->Position = this->Tree->UpPositions[this->Position - 1]; | 62 | 2 | } |
Unexecuted instantiation: cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator::operator++() Unexecuted instantiation: cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::operator++() Unexecuted instantiation: cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::operator++() |
63 | | |
64 | | PointerType operator->() const |
65 | 26 | { |
66 | 26 | assert(this->Tree); |
67 | 26 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
68 | 26 | assert(this->Position <= this->Tree->Data.size()); |
69 | 26 | assert(this->Position > 0); |
70 | 26 | return this->Tree->GetPointer(this->Position - 1); |
71 | 26 | } cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::operator->() const Line | Count | Source | 65 | 25 | { | 66 | 25 | assert(this->Tree); | 67 | 25 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 68 | 25 | assert(this->Position <= this->Tree->Data.size()); | 69 | | assert(this->Position > 0); | 70 | 25 | return this->Tree->GetPointer(this->Position - 1); | 71 | 25 | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator::operator->() const Line | Count | Source | 65 | 1 | { | 66 | 1 | assert(this->Tree); | 67 | 1 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 68 | 1 | assert(this->Position <= this->Tree->Data.size()); | 69 | | assert(this->Position > 0); | 70 | 1 | return this->Tree->GetPointer(this->Position - 1); | 71 | 1 | } |
|
72 | | |
73 | | PointerType operator->() |
74 | 728 | { |
75 | 728 | assert(this->Tree); |
76 | 728 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
77 | 728 | assert(this->Position <= this->Tree->Data.size()); |
78 | 728 | assert(this->Position > 0); |
79 | 728 | return this->Tree->GetPointer(this->Position - 1); |
80 | 728 | } cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator::operator->() Line | Count | Source | 74 | 38 | { | 75 | 38 | assert(this->Tree); | 76 | 38 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 77 | 38 | assert(this->Position <= this->Tree->Data.size()); | 78 | | assert(this->Position > 0); | 79 | 38 | return this->Tree->GetPointer(this->Position - 1); | 80 | 38 | } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator::operator->() Line | Count | Source | 74 | 600 | { | 75 | 600 | assert(this->Tree); | 76 | 600 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 77 | 600 | assert(this->Position <= this->Tree->Data.size()); | 78 | | assert(this->Position > 0); | 79 | 600 | return this->Tree->GetPointer(this->Position - 1); | 80 | 600 | } |
cmLinkedTree<cmDefinitions>::iterator::operator->() Line | Count | Source | 74 | 90 | { | 75 | 90 | assert(this->Tree); | 76 | 90 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 77 | 90 | assert(this->Position <= this->Tree->Data.size()); | 78 | | assert(this->Position > 0); | 79 | 90 | return this->Tree->GetPointer(this->Position - 1); | 80 | 90 | } |
Unexecuted instantiation: cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::operator->() Unexecuted instantiation: cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::operator->() |
81 | | |
82 | | ReferenceType operator*() const |
83 | 2 | { |
84 | 2 | assert(this->Tree); |
85 | 2 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
86 | 2 | assert(this->Position <= this->Tree->Data.size()); |
87 | 2 | assert(this->Position > 0); |
88 | 2 | return this->Tree->GetReference(this->Position - 1); |
89 | 2 | } |
90 | | |
91 | | ReferenceType operator*() |
92 | 2 | { |
93 | 2 | assert(this->Tree); |
94 | 2 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
95 | 2 | assert(this->Position <= this->Tree->Data.size()); |
96 | 2 | assert(this->Position > 0); |
97 | 2 | return this->Tree->GetReference(this->Position - 1); |
98 | 2 | } 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 | } |
Unexecuted instantiation: cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::iterator::operator*() Unexecuted instantiation: cmLinkedTree<cmDefinitions>::iterator::operator*() |
99 | | |
100 | | bool operator==(iterator other) const |
101 | 52 | { |
102 | 52 | assert(this->Tree); |
103 | 52 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
104 | 52 | assert(this->Tree == other.Tree); |
105 | 52 | return this->Position == other.Position; |
106 | 52 | } cmLinkedTree<cmDefinitions>::iterator::operator==(cmLinkedTree<cmDefinitions>::iterator) const Line | Count | Source | 101 | 2 | { | 102 | 2 | assert(this->Tree); | 103 | 2 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 104 | | assert(this->Tree == other.Tree); | 105 | 2 | return this->Position == other.Position; | 106 | 2 | } |
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 | 48 | { | 102 | 48 | assert(this->Tree); | 103 | 48 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 104 | | assert(this->Tree == other.Tree); | 105 | 48 | return this->Position == other.Position; | 106 | 48 | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::operator==(cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator) const Line | Count | Source | 101 | 1 | { | 102 | 1 | assert(this->Tree); | 103 | 1 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 104 | | assert(this->Tree == other.Tree); | 105 | 1 | return this->Position == other.Position; | 106 | 1 | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::operator==(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator) const Line | Count | Source | 101 | 1 | { | 102 | 1 | assert(this->Tree); | 103 | 1 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 104 | | assert(this->Tree == other.Tree); | 105 | 1 | return this->Position == other.Position; | 106 | 1 | } |
|
107 | | |
108 | | bool operator!=(iterator other) const |
109 | 50 | { |
110 | 50 | assert(this->Tree); |
111 | 50 | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); |
112 | 50 | return !(*this == other); |
113 | 50 | } 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 | 48 | { | 110 | 48 | assert(this->Tree); | 111 | | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 112 | 48 | return !(*this == other); | 113 | 48 | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator::operator!=(cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator) const Line | Count | Source | 109 | 1 | { | 110 | 1 | assert(this->Tree); | 111 | | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 112 | 1 | return !(*this == other); | 113 | 1 | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator::operator!=(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator) const Line | Count | Source | 109 | 1 | { | 110 | 1 | assert(this->Tree); | 111 | | assert(this->Tree->UpPositions.size() == this->Tree->Data.size()); | 112 | 1 | return !(*this == other); | 113 | 1 | } |
|
114 | | |
115 | | bool IsValid() const |
116 | 48 | { |
117 | 48 | if (!this->Tree) { |
118 | 0 | return false; |
119 | 0 | } |
120 | 48 | return this->Position <= this->Tree->Data.size(); |
121 | 48 | } |
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 | 379 | { |
133 | 379 | return iterator(const_cast<cmLinkedTree*>(this), 0); |
134 | 379 | } cmLinkedTree<cmStateDetail::PolicyStackEntry>::Root() const Line | Count | Source | 132 | 72 | { | 133 | 72 | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 72 | } |
cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::Root() const Line | Count | Source | 132 | 72 | { | 133 | 72 | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 72 | } |
cmLinkedTree<cmDefinitions>::Root() const Line | Count | Source | 132 | 72 | { | 133 | 72 | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 72 | } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::Root() const Line | Count | Source | 132 | 117 | { | 133 | 117 | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 117 | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::Root() const Line | Count | Source | 132 | 23 | { | 133 | 23 | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 23 | } |
cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Root() const Line | Count | Source | 132 | 23 | { | 133 | 23 | return iterator(const_cast<cmLinkedTree*>(this), 0); | 134 | 23 | } |
|
135 | | |
136 | 93 | iterator Push(iterator it) { return this->Push_impl(it, T()); }cmLinkedTree<cmDefinitions>::Push(cmLinkedTree<cmDefinitions>::iterator) Line | Count | Source | 136 | 24 | iterator Push(iterator it) { return this->Push_impl(it, T()); } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::Push(cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator) Line | Count | Source | 136 | 23 | iterator Push(iterator it) { return this->Push_impl(it, T()); } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::Push(cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator) Line | Count | Source | 136 | 23 | 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 | 23 | iterator Push(iterator it) { return this->Push_impl(it, T()); } |
|
137 | | |
138 | 29 | 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 | 25 | 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 | 2 | 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 | 1 | 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 | 1 | 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 | 4 | 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 | 2 | T& GetReference(PositionType pos) { return this->Data[pos]; } |
Unexecuted instantiation: cmLinkedTree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::GetReference(unsigned long) Unexecuted instantiation: cmLinkedTree<cmDefinitions>::GetReference(unsigned long) |
175 | | |
176 | 754 | T* GetPointer(PositionType pos) { return &this->Data[pos]; }cmLinkedTree<cmStateDetail::SnapshotDataType>::GetPointer(unsigned long) Line | Count | Source | 176 | 625 | T* GetPointer(PositionType pos) { return &this->Data[pos]; } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::GetPointer(unsigned long) Line | Count | Source | 176 | 39 | T* GetPointer(PositionType pos) { return &this->Data[pos]; } |
cmLinkedTree<cmDefinitions>::GetPointer(unsigned long) Line | Count | Source | 176 | 90 | T* GetPointer(PositionType pos) { return &this->Data[pos]; } |
Unexecuted instantiation: cmLinkedTree<cmStateDetail::PolicyStackEntry>::GetPointer(unsigned long) Unexecuted instantiation: cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::GetPointer(unsigned long) |
177 | | |
178 | | iterator Push_impl(iterator it, T&& t) |
179 | 122 | { |
180 | 122 | assert(this->UpPositions.size() == this->Data.size()); |
181 | | assert(it.Position <= this->UpPositions.size()); |
182 | 122 | this->UpPositions.push_back(it.Position); |
183 | 122 | this->Data.push_back(std::move(t)); |
184 | 122 | return iterator(this, this->UpPositions.size()); |
185 | 122 | } cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::Push_impl(cmLinkedTree<cmStateDetail::DiagnosticStackEntry>::iterator, cmStateDetail::DiagnosticStackEntry&&) Line | Count | Source | 179 | 25 | { | 180 | 25 | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 25 | this->UpPositions.push_back(it.Position); | 183 | 25 | this->Data.push_back(std::move(t)); | 184 | 25 | return iterator(this, this->UpPositions.size()); | 185 | 25 | } |
cmLinkedTree<cmDefinitions>::Push_impl(cmLinkedTree<cmDefinitions>::iterator, cmDefinitions&&) Line | Count | Source | 179 | 24 | { | 180 | 24 | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 24 | this->UpPositions.push_back(it.Position); | 183 | 24 | this->Data.push_back(std::move(t)); | 184 | 24 | return iterator(this, this->UpPositions.size()); | 185 | 24 | } |
cmLinkedTree<cmStateDetail::SnapshotDataType>::Push_impl(cmLinkedTree<cmStateDetail::SnapshotDataType>::iterator, cmStateDetail::SnapshotDataType&&) Line | Count | Source | 179 | 25 | { | 180 | 25 | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 25 | this->UpPositions.push_back(it.Position); | 183 | 25 | this->Data.push_back(std::move(t)); | 184 | 25 | return iterator(this, this->UpPositions.size()); | 185 | 25 | } |
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::Push_impl(cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator, cmStateDetail::BuildsystemDirectoryStateType&&) Line | Count | Source | 179 | 23 | { | 180 | 23 | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 23 | this->UpPositions.push_back(it.Position); | 183 | 23 | this->Data.push_back(std::move(t)); | 184 | 23 | return iterator(this, this->UpPositions.size()); | 185 | 23 | } |
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 | 24 | { | 180 | 24 | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 24 | this->UpPositions.push_back(it.Position); | 183 | 24 | this->Data.push_back(std::move(t)); | 184 | 24 | return iterator(this, this->UpPositions.size()); | 185 | 24 | } |
cmLinkedTree<cmStateDetail::PolicyStackEntry>::Push_impl(cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator, cmStateDetail::PolicyStackEntry&&) Line | Count | Source | 179 | 1 | { | 180 | 1 | assert(this->UpPositions.size() == this->Data.size()); | 181 | | assert(it.Position <= this->UpPositions.size()); | 182 | 1 | this->UpPositions.push_back(it.Position); | 183 | 1 | this->Data.push_back(std::move(t)); | 184 | 1 | return iterator(this, this->UpPositions.size()); | 185 | 1 | } |
|
186 | | |
187 | | std::vector<T> Data; |
188 | | std::vector<PositionType> UpPositions; |
189 | | }; |