[btree] visitor now passed as a reference rather than shared_ptr
This commit is contained in:
@ -334,7 +334,7 @@ namespace persistent_data {
|
||||
};
|
||||
|
||||
// Walks the tree in depth first order
|
||||
void visit_depth_first(typename visitor::ptr visitor) const;
|
||||
void visit_depth_first(visitor &visitor) const;
|
||||
|
||||
private:
|
||||
template <typename ValueTraits2, typename Search>
|
||||
@ -362,7 +362,7 @@ namespace persistent_data {
|
||||
uint64_t key,
|
||||
int *index);
|
||||
|
||||
void walk_tree(typename visitor::ptr visitor,
|
||||
void walk_tree(visitor &visitor,
|
||||
btree_detail::node_location const &loc,
|
||||
block_address b) const;
|
||||
|
||||
|
@ -742,7 +742,7 @@ insert_location(btree_detail::shadow_spine &spine,
|
||||
|
||||
template <unsigned Levels, typename ValueTraits>
|
||||
void
|
||||
btree<Levels, ValueTraits>::visit_depth_first(typename visitor::ptr visitor) const
|
||||
btree<Levels, ValueTraits>::visit_depth_first(visitor &v) const
|
||||
{
|
||||
node_location loc;
|
||||
|
||||
@ -751,13 +751,13 @@ btree<Levels, ValueTraits>::visit_depth_first(typename visitor::ptr visitor) con
|
||||
loc.sub_root = true;
|
||||
loc.key = boost::optional<uint64_t>();
|
||||
|
||||
walk_tree(visitor, loc, root_);
|
||||
visitor->visit_complete();
|
||||
walk_tree(v, loc, root_);
|
||||
v.visit_complete();
|
||||
}
|
||||
|
||||
template <unsigned Levels, typename ValueTraits>
|
||||
void
|
||||
btree<Levels, ValueTraits>::walk_tree(typename visitor::ptr visitor,
|
||||
btree<Levels, ValueTraits>::walk_tree(visitor &v,
|
||||
node_location const &loc,
|
||||
block_address b) const
|
||||
{
|
||||
@ -766,7 +766,7 @@ btree<Levels, ValueTraits>::walk_tree(typename visitor::ptr visitor,
|
||||
read_ref blk = tm_->read_lock(b);
|
||||
internal_node o = to_node<uint64_traits>(blk);
|
||||
if (o.get_type() == INTERNAL) {
|
||||
if (visitor->visit_internal(loc, o))
|
||||
if (v.visit_internal(loc, o))
|
||||
for (unsigned i = 0; i < o.get_nr_entries(); i++) {
|
||||
node_location loc2(loc);
|
||||
|
||||
@ -774,11 +774,11 @@ btree<Levels, ValueTraits>::walk_tree(typename visitor::ptr visitor,
|
||||
loc2.sub_root = false;
|
||||
loc2.key = boost::optional<uint64_t>(o.key_at(i));
|
||||
|
||||
walk_tree(visitor, loc2, o.value_at(i));
|
||||
walk_tree(v, loc2, o.value_at(i));
|
||||
}
|
||||
|
||||
} else if (loc.level < Levels - 1) {
|
||||
if (visitor->visit_internal_leaf(loc, o))
|
||||
if (v.visit_internal_leaf(loc, o))
|
||||
for (unsigned i = 0; i < o.get_nr_entries(); i++) {
|
||||
node_location loc2(loc);
|
||||
|
||||
@ -787,12 +787,12 @@ btree<Levels, ValueTraits>::walk_tree(typename visitor::ptr visitor,
|
||||
loc2.sub_root = true;
|
||||
loc2.key = boost::optional<uint64_t>(o.key_at(i));
|
||||
|
||||
walk_tree(visitor, loc, o.value_at(i));
|
||||
walk_tree(v, loc, o.value_at(i));
|
||||
}
|
||||
|
||||
} else {
|
||||
leaf_node ov = to_node<ValueTraits>(blk);
|
||||
visitor->visit_leaf(loc, ov);
|
||||
v.visit_leaf(loc, ov);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user