position_in_partition: Make printable

This commit is contained in:
Tomasz Grabiec
2017-02-10 13:59:44 +01:00
parent fb67dab548
commit f2e1f2938b
2 changed files with 17 additions and 0 deletions

View File

@@ -37,6 +37,20 @@ operator<<(std::ostream& os, const static_row& row) {
return os << "{static_row: "<< row._cells << "}";
}
std::ostream& operator<<(std::ostream& out, position_in_partition_view pos) {
out << "{position: " << pos._bound_weight << ":";
if (pos._ck) {
out << *pos._ck;
} else {
out << "null";
}
return out << "}";
}
std::ostream& operator<<(std::ostream& out, const position_in_partition& pos) {
return out << static_cast<position_in_partition_view>(pos);
}
mutation_fragment::mutation_fragment(static_row&& r)
: _kind(kind::static_row), _data(std::make_unique<data>())
{

View File

@@ -321,6 +321,8 @@ public:
: _ck(&ck) { }
position_in_partition_view(range_tag_t, bound_view bv)
: _bound_weight(weight(bv.kind)), _ck(&bv.prefix) { }
friend std::ostream& operator<<(std::ostream&, position_in_partition_view);
};
class position_in_partition {
@@ -438,6 +440,7 @@ public:
return compare(a, b);
}
};
friend std::ostream& operator<<(std::ostream&, const position_in_partition&);
};
inline position_in_partition_view static_row::position() const