CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
28 namespace catapult {
namespace tree {
37 template<
typename TKey>
39 if constexpr (utils::traits::is_scalar_v<TKey>) {
41 m_path.resize(
sizeof(TKey));
44 const auto* pKeyData = reinterpret_cast<const uint8_t*>(&key);
45 std::reverse_copy(pKeyData, pKeyData +
sizeof(TKey),
m_path.begin());
49 std::copy(key.cbegin(), key.cend(),
m_path.begin());
65 uint8_t
nibbleAt(
size_t index)
const;
size_t FindFirstDifferenceIndex(const TreeNodePath &lhs, const TreeNodePath &rhs)
Compares two paths (lhs and rhs) and returns the index of the first non-equal nibble.
Definition: TreeNodePath.cpp:142
bool empty() const
Returns true if this path is empty.
Definition: TreeNodePath.cpp:54
TreeNodePath subpath(size_t offset) const
Creates a subpath starting at nibble offset.
Definition: TreeNodePath.cpp:78
bool operator!=(const TreeNodePath &rhs) const
Returns true if this path is not equal to rhs.
Definition: TreeNodePath.cpp:74
uint8_t nibbleAt(size_t index) const
Gets the nibble at index.
Definition: TreeNodePath.cpp:62
std::ostream & operator<<(std::ostream &out, const TreeNodePath &path)
Insertion operator for outputting path to out.
Definition: TreeNodePath.cpp:133
size_t m_adjustment
Definition: TreeNodePath.h:90
TreeNodePath(TKey key)
Creates a path from key.
Definition: TreeNodePath.h:38
size_t m_index
Definition: TreeNodePath.cpp:111
std::vector< uint8_t > m_path
Definition: TreeNodePath.cpp:112
std::vector< uint8_t > m_path
Definition: TreeNodePath.h:91
uint64_t size
Definition: MemoryCounters.cpp:65
bool operator==(const TreeNodePath &rhs) const
Returns true if this path is equal to rhs.
Definition: TreeNodePath.cpp:70
Definition: AddressExtractionExtension.cpp:28
size_t size() const
Gets the number of nibbles in this path.
Definition: TreeNodePath.cpp:58
static TreeNodePath Join(const TreeNodePath &lhs, const TreeNodePath &rhs)
Joins lhs and rhs into a new path.
Definition: TreeNodePath.cpp:116
TreeNodePath()
Creates a default path.
Definition: TreeNodePath.cpp:39
size_t m_size
Definition: TreeNodePath.h:89
Represents a path in a tree.
Definition: TreeNodePath.h:31