cesium-native 0.48.0
Loading...
Searching...
No Matches
LoadedTileEnumerator.h
1#pragma once
2
3#include <iterator>
4#include <vector>
5
7
8class Tile;
9class TilesetContentManager;
10
11// The LoadedConstTileEnumerator and LoadedTileEnumerator could probably be
12// replaced with ranges, except that we need to support Android and range
13// support prior to NDK r26 is shaky. Unreal Engine 5.5 uses r25b and Unity
14// 2022.3 uses r23b. See here: https://github.com/android/ndk/issues/1530
15
26public:
30 class const_iterator {
31 public:
35 using iterator_category = std::forward_iterator_tag;
39 using value_type = const Tile;
46 using difference_type = void;
50 using pointer = const Tile*;
54 using reference = const Tile&;
55
59 const Tile& operator*() const noexcept;
63 const Tile* operator->() const noexcept;
64
68 const_iterator& operator++() noexcept;
72 const_iterator operator++(int) noexcept;
73
75 bool operator==(const const_iterator& rhs) const noexcept;
77 bool operator!=(const const_iterator& rhs) const noexcept;
78
79 private:
80 explicit const_iterator(const Tile* pRootTile) noexcept;
81
82 std::vector<const Tile*> _traversalStack;
83
84 friend class LoadedTileEnumerator;
85 friend class LoadedConstTileEnumerator;
86 };
87
98 explicit LoadedConstTileEnumerator(const Tile* pRootTile) noexcept;
99
101 const_iterator begin() const noexcept;
103 const_iterator end() const noexcept;
104
105private:
106 const Tile* _pRootTile;
107
108 template <typename TIterator> static TIterator& increment(TIterator& it);
109 friend class LoadedTileEnumerator;
110};
111
114public:
119
123 class iterator {
124 public:
128 using iterator_category = std::forward_iterator_tag;
139 using difference_type = void;
143 using pointer = Tile*;
147 using reference = Tile&;
148
152 Tile& operator*() const noexcept;
156 Tile* operator->() const noexcept;
157
161 iterator& operator++() noexcept;
165 iterator operator++(int) noexcept;
166
168 bool operator==(const iterator& rhs) const noexcept;
170 bool operator!=(const iterator& rhs) const noexcept;
171
172 private:
173 explicit iterator(Tile* pRootTile) noexcept;
174
175 std::vector<Tile*> _traversalStack;
176
177 friend class LoadedTileEnumerator;
178 friend class LoadedConstTileEnumerator;
179 };
180
182 explicit LoadedTileEnumerator(Tile* pRootTile) noexcept;
183
185 const_iterator begin() const noexcept;
187 const_iterator end() const noexcept;
188
190 iterator begin() noexcept;
192 iterator end() noexcept;
193
194private:
195 Tile* _pRootTile;
196};
197
198} // namespace Cesium3DTilesSelection
const Tile value_type
The type of value that is being iterated over.
const Tile & operator*() const noexcept
Returns a reference to the current item being iterated.
void difference_type
The type used to identify distance between iterators.
std::forward_iterator_tag iterator_category
The iterator category tag denoting this is a forward iterator.
const Tile * pointer
A pointer to the type being iterated over.
const Tile & reference
A reference to the type being iterated over.
const_iterator begin() const noexcept
Returns an iterator starting at the first tile.
const_iterator end() const noexcept
Returns an iterator starting after the last tile.
LoadedConstTileEnumerator(const Tile *pRootTile) noexcept
Creates a new instance to enumerate loaded tiles in the subtree rooted at pRootTile.
std::forward_iterator_tag iterator_category
The iterator category tag denoting this is a forward iterator.
Tile & reference
A reference to the type being iterated over.
Tile value_type
The type of value that is being iterated over.
Tile * pointer
A pointer to the type being iterated over.
void difference_type
The type used to identify distance between iterators.
Tile & operator*() const noexcept
Returns a reference to the current item being iterated.
const_iterator end() const noexcept
Returns an iterator starting after the last tile.
const_iterator begin() const noexcept
Returns an iterator starting at the first tile.
LoadedConstTileEnumerator::const_iterator const_iterator
An iterator over constant Tile instances.
LoadedTileEnumerator(Tile *pRootTile) noexcept
Creates a new instance to enumerate loaded tiles in the subtree rooted at pRootTile.
A tile in a Tileset.
Definition Tile.h:122
Classes that implement the 3D Tiles standard.
STL namespace.