18 #ifndef PSTORE_CORE_DIFF_HPP 19 #define PSTORE_CORE_DIFF_HPP 25 namespace diff_details {
27 template <
typename Index>
40 , threshold_{threshold} {}
45 template <
typename OutputIterator>
46 OutputIterator
operator() (OutputIterator out)
const;
54 template <
typename OutputIterator>
55 OutputIterator visit_node (
index_pointer node,
unsigned shifts,
56 OutputIterator out)
const;
66 template <
typename Node,
typename OutputIterator>
67 OutputIterator visit_intermediate (
index_pointer node,
unsigned shifts,
68 OutputIterator out)
const;
72 node.untag_address<
internal_node> ().to_address () >= threshold_;
82 template <
typename Index>
83 template <
typename OutputIterator>
85 if (
auto const root = index_.root ()) {
86 out = this->visit_node (root, 0U, out);
93 template <
typename Index>
94 template <
typename OutputIterator>
96 OutputIterator out)
const {
101 if (this->is_new (node)) {
102 *out = node.to_address ();
108 if (index::details::depth_is_internal_node (shifts)) {
109 return this->visit_intermediate<index::details::internal_node> (node, shifts,
113 return this->visit_intermediate<index::details::linear_node> (node, shifts, out);
118 template <
typename Index>
119 template <
typename Node,
typename OutputIterator>
122 unsigned const shifts, OutputIterator out)
const {
123 std::pair<std::shared_ptr<void const>, Node
const *>
const p =
124 Node::get_node (db_, node);
125 PSTORE_ASSERT (std::get<Node const *> (p) !=
nullptr);
126 for (
auto child : *std::get<Node const *> (p)) {
127 if (this->is_new (node)) {
129 shifts + index::details::hash_index_bits, out);
147 template <
typename Index,
typename OutputIterator>
148 OutputIterator
diff (
database const & db, Index
const & index, revision_number
const old,
149 OutputIterator out) {
160 #endif // PSTORE_CORE_DIFF_HPP OutputIterator diff(database const &db, Index const &index, revision_number const old, OutputIterator out)
Write a series of addresses to an output iterator of the objects that were added to an index between ...
Definition: diff.hpp:148
typed_address< trailer > older_revision_footer_pos(unsigned revision) const
Returns the address of the footer of a specified revision.
Definition: database.cpp:147
Definition: address.hpp:81
bool is_address() const noexcept
Returns true if the index_pointer is pointing to a store node, false otherwise.
Definition: hamt_map_types.hpp:221
constexpr traverser(database const &db, Index const &index, address threshold) noexcept
Definition: diff.hpp:36
bool is_heap() const noexcept
Returns true if the index_pointer is pointing to a heap node, false otherwise.
Definition: hamt_map_types.hpp:215
OutputIterator operator()(OutputIterator out) const
Definition: diff.hpp:84
bool is_leaf() const noexcept
Returns true if the index_pointer contains the address of a value in the store, false otherwise...
Definition: hamt_map_types.hpp:211
unsigned get_current_revision() const
Returns the generation number to which the database is synced.
Definition: database.hpp:262
An internal trie node.
Definition: hamt_map_types.hpp:508
Definition: nonpod2.cpp:40
Definition: database.hpp:40
An index pointer is either a database address or a pointer to volatile RAM.
Definition: hamt_map_types.hpp:132