33template <
typename _T,
bool _Const = false>
40 using reference =
typename std::conditional_t<_Const, const _T&, _T&>;
41 using pointer =
typename std::conditional_t<_Const, const _T*, _T*>;
47 if (!current_ || !other.current_) {
50 return (current_.get() == other.current_.get());
53 return current_->ptr() == other.current_->ptr();
67 const uint64_t next_entry_offset = current_->NextEntryOffset();
71 if (next_entry_offset) {
73 pNextEntry = current_->ptr() + next_entry_offset;
74 if (pNextEntry >= buffer_end_) {
81 previous_ = std::move(current_);
82 current_ = make_shared_func_(pNextEntry, buffer_end_.address() - pNextEntry.
address());
102 std::function<std::shared_ptr<_T>(
const guest_ptr<void>&, uint32_t)> make_shared_func,
104 : make_shared_func_(make_shared_func), current_(value), buffer_end_(buffer_end) {}
106 std::function<std::shared_ptr<_T>(
const guest_ptr<void>&, uint32_t)> make_shared_func,
108 : make_shared_func_(make_shared_func), current_(std::move(value)), buffer_end_(buffer_end) {
115 template <
bool _Const_ = _Const,
class = std::enable_if_t<_Const_>>
117 : make_shared_func_(src.make_shared_func_), current_(src.current_),
118 previous_(src.previous_), buffer_end_(src.buffer_end_) {}
127 std::function<std::shared_ptr<_T>(
const guest_ptr<void>&, uint32_t)> make_shared_func_;
128 std::shared_ptr<_T> current_;
129 std::shared_ptr<_T> previous_;
Definition guest_ptr.hh:88
uint64_t address() const
Functions for getting the underlying address.
Definition guest_ptr.hh:124
Iterator helper for _INFORMATION types that have a NextEntryOffset field.
Definition offset_iterator.hh:34
pointer operator->() const
Definition offset_iterator.hh:45
std::forward_iterator_tag iterator_category
Definition offset_iterator.hh:36
typename std::conditional_t< _Const, const _T &, _T & > reference
Definition offset_iterator.hh:40
offset_iterator & operator++()
Definition offset_iterator.hh:60
typename std::conditional_t< _Const, const _T *, _T * > pointer
Definition offset_iterator.hh:41
offset_iterator(std::function< std::shared_ptr< _T >(const guest_ptr< void > &, uint32_t)> make_shared_func, std::shared_ptr< _T > &&value, const guest_ptr< void > &buffer_end)
Definition offset_iterator.hh:105
bool operator==(const offset_iterator< _T, _Const > &other) const
Definition offset_iterator.hh:46
offset_iterator(const offset_iterator< _T, false > &src)
Definition offset_iterator.hh:116
offset_iterator< _T, _Const > & operator=(const offset_iterator< _T, _Const > &)=default
offset_iterator()
Definition offset_iterator.hh:112
reference operator*() const
Definition offset_iterator.hh:44
offset_iterator operator++(int)
Definition offset_iterator.hh:93
bool operator!=(const offset_iterator< _T, _Const > &other) const
Definition offset_iterator.hh:55
offset_iterator(std::function< std::shared_ptr< _T >(const guest_ptr< void > &, uint32_t)> make_shared_func, const std::shared_ptr< _T > &value, const guest_ptr< void > &buffer_end)
Definition offset_iterator.hh:101
pointer previous() const
Definition offset_iterator.hh:99
void value_type
Definition offset_iterator.hh:37
#define unlikely(x)
Definition compiler.hh:27
Type-safe guest virtual address pointer and guest_ptr template.
Core IntroVirt classes.
Definition Cr0.hh:20