| 114 | /// Ring buffer iterator |
| 115 | /// </summary> |
| 116 | struct Iterator |
| 117 | { |
| 118 | friend EventBuffer; |
| 119 | |
| 120 | private: |
| 121 | EventBuffer* _buffer; |
| 122 | int32 _index; |
| 123 | |
| 124 | FORCE_INLINE Iterator(EventBuffer* buffer, const int32 index) |
| 125 | : _buffer(buffer) |
| 126 | , _index(index) |
| 127 | { |
| 128 | } |
| 129 | |
| 130 | public: |
| 131 | FORCE_INLINE Iterator(const Iterator& other) |
| 132 | : _buffer(other._buffer) |
| 133 | , _index(other._index) |
| 134 | { |
| 135 | } |
| 136 | |
| 137 | FORCE_INLINE Iterator(Iterator&& other) noexcept |
| 138 | : _buffer(other._buffer) |
| 139 | , _index(other._index) |
| 140 | { |
| 141 | } |
| 142 | |
| 143 | FORCE_INLINE Iterator& operator=(Iterator&& other) |
| 144 | { |
| 145 | _buffer = other._buffer; |
| 146 | _index = other._index; |
| 147 | return *this; |
| 148 | } |
| 149 | |
| 150 | FORCE_INLINE Iterator& operator=(const Iterator& other) |
| 151 | { |
| 152 | _buffer = other._buffer; |
| 153 | _index = other._index; |
| 154 | return *this; |
| 155 | } |
| 156 | |
| 157 | FORCE_INLINE int32 Index() const |
| 158 | { |
| 159 | return _index; |
| 160 | } |
| 161 | |
| 162 | FORCE_INLINE Event& Event() const |
| 163 | { |
| 164 | ASSERT_LOW_LAYER(_buffer && _index >= 0 && _index < _buffer->_capacity); |
| 165 | return _buffer->Get(_index); |
| 166 | } |
| 167 | |
| 168 | FORCE_INLINE bool IsEnd() const |
| 169 | { |
| 170 | return _index == _buffer->_head; |
| 171 | } |
| 172 | |
| 173 | FORCE_INLINE bool IsNotEnd() const |