Kagome
Polkadot Runtime Engine in C++17
kagome::storage::trie::KeyNibbles Struct Reference

#include <trie_node.hpp>

Inheritance diagram for kagome::storage::trie::KeyNibbles:
Collaboration diagram for kagome::storage::trie::KeyNibbles:

Public Types

using Buffer = common::Buffer
 
- Public Types inherited from kagome::common::SLBuffer< MaxSize >
using Base = SLVector< uint8_t, MaxSize >
 
template<size_t OtherMaxSize>
using OtherSLBuffer = SLBuffer< OtherMaxSize >
 
using Base = BaseContainer
 

Public Member Functions

 KeyNibbles (common::Buffer b)
 
auto toByteBuffer () const
 
NibblesView subspan (size_t offset=0, size_t length=-1) const
 
- Public Member Functions inherited from kagome::common::SLBuffer< MaxSize >
 SLBuffer ()=default
 
 SLBuffer (const typename Base::Base &other)
 lvalue construct buffer from a byte vector More...
 
 SLBuffer (typename Base::Base &&other)
 
template<size_t OtherMaxSize>
 SLBuffer (const OtherSLBuffer< OtherMaxSize > &other)
 
template<size_t OtherMaxSize>
 SLBuffer (OtherSLBuffer< OtherMaxSize > &&other)
 
 SLBuffer (const BufferView &s)
 
template<size_t N>
 SLBuffer (const std::array< typename Base::value_type, N > &other)
 
 SLBuffer (const uint8_t *begin, const uint8_t *end)
 
SLBufferreserve (size_t size)
 
SLBufferresize (size_t size)
 
SLBufferoperator+= (const BufferView &view) noexcept
 
SLBufferputUint8 (uint8_t n)
 Put a 8-bit {. More...
 
SLBufferputUint32 (uint32_t n)
 Put a 32-bit {. More...
 
SLBufferputUint64 (uint64_t n)
 Put a 64-bit {. More...
 
SLBufferput (std::string_view view)
 Put a string into byte buffer. More...
 
SLBufferput (const BufferView &view)
 Put a sequence of bytes as view into byte buffer. More...
 
const std::vector< uint8_t > & asVector () const
 getter for vector of bytes More...
 
std::vector< uint8_t > & asVector ()
 
std::vector< uint8_t > toVector ()&
 
std::vector< uint8_t > toVector ()&&
 
SLBuffer subbuffer (size_t offset=0, size_t length=-1) const
 
BufferView view (size_t offset=0, size_t length=-1) const
 
std::string toHex () const
 encode bytearray as hex More...
 
std::string toString () const
 return content of bytearray as string More...
 
std::string_view asString () const
 return content of bytearray as a string copy data More...
 
bool operator== (const BufferView &other) const noexcept
 
template<size_t N>
bool operator== (const std::array< typename Base::value_type, N > &other) const noexcept
 
bool operator< (const BufferView &other) const noexcept
 
template<size_t N>
bool operator< (const std::array< typename Base::value_type, N > &other) const noexcept
 
- Public Member Functions inherited from kagome::common::SizeLimitedContainer< BaseContainer, MaxSize >
constexpr Base::size_type max_size ()
 
 SizeLimitedContainer ()=default
 
 SizeLimitedContainer (size_t size)
 
 SizeLimitedContainer (size_t size, const typename Base::value_type &value)
 
 SizeLimitedContainer (const Base &other)
 
 SizeLimitedContainer (Base &&other)
 
template<typename Iter , typename = std::enable_if_t<std::is_base_of_v< std::input_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>>>
 SizeLimitedContainer (Iter begin, Iter end)
 
 SizeLimitedContainer (std::initializer_list< typename Base::value_type > list)
 
SizeLimitedContaineroperator= (const Base &other)
 
SizeLimitedContaineroperator= (Base &&other)
 
SizeLimitedContaineroperator= (std::initializer_list< typename Base::value_type > list)
 
void assign (typename Base::size_type size, const typename Base::value_type &value)
 
template<typename Iter , typename = std::enable_if_t<std::is_base_of_v< std::input_iterator_tag, typename std::iterator_traits<Iter>::iterator_category>>>
void assign (Iter begin, Iter end)
 
void assign (std::initializer_list< typename Base::value_type > list)
 
template<typename... Args>
Base::reference & emplace_back (Args &&...args)
 
template<typename Iter , typename... Args, bool isIter = std::is_same_v<Iter, typename Base::iterator>, bool isConstIter = std::is_same_v<Iter, typename Base::const_iterator>, typename = std::enable_if_t<isIter or isConstIter>>
Base::iterator emplace (Iter pos, Args &&...args)
 
template<typename Iter , bool isIter = std::is_same_v<Iter, typename Base::iterator>, bool isConstIter = std::is_same_v<Iter, typename Base::const_iterator>, typename = std::enable_if_t<isIter or isConstIter>>
Base::iterator insert (Iter pos, const typename Base::value_type &value)
 
template<typename Iter , bool isIter = std::is_same_v<Iter, typename Base::iterator>, bool isConstIter = std::is_same_v<Iter, typename Base::const_iterator>, typename = std::enable_if_t<isIter or isConstIter>>
Base::iterator insert (Iter pos, typename Base::size_type size, const typename Base::value_type &value)
 
template<typename OutIt , typename InIt , bool isIter = std::is_same_v<OutIt, typename Base::iterator>, bool isConstIter = std::is_same_v<OutIt, typename Base::const_iterator>, typename = std::enable_if_t<isIter or isConstIter>, typename = std::enable_if_t<std::is_base_of_v< std::input_iterator_tag, typename std::iterator_traits<InIt>::iterator_category>>>
Base::iterator insert (OutIt pos, InIt begin, InIt end)
 
template<typename Iter , bool isIter = std::is_same_v<Iter, typename Base::iterator>, bool isConstIter = std::is_same_v<Iter, typename Base::const_iterator>, typename = std::enable_if_t<isIter or isConstIter>>
Base::iterator insert (Iter pos, std::initializer_list< typename Base::value_type > &&list)
 
template<typename V >
void push_back (V &&value)
 
void reserve (typename Base::size_type size)
 
void resize (typename Base::size_type size)
 
void resize (typename Base::size_type size, const typename Base::value_type &value)
 
bool operator== (const Base &other) const noexcept
 
bool operator== (const Span &other) const noexcept
 
bool operator!= (const Base &other) const noexcept
 
bool operator!= (const Span &other) const noexcept
 
bool operator< (const Base &other) const noexcept
 
bool operator< (const Span &other) const noexcept
 

Static Public Member Functions

static KeyNibbles fromByteBuffer (const common::BufferView &key)
 
static uint8_t toByte (uint8_t high, uint8_t low)
 
- Static Public Member Functions inherited from kagome::common::SLBuffer< MaxSize >
static outcome::result< SLBufferfromHex (std::string_view hex)
 Construct SLBuffer from hex string. More...
 
static SLBuffer fromString (const std::string_view &src)
 stores content of a string to byte array More...
 

Additional Inherited Members

- Static Public Attributes inherited from kagome::common::SizeLimitedContainer< BaseContainer, MaxSize >
static constexpr bool is_static_collection = false
 
- Protected Types inherited from kagome::common::SizeLimitedContainer< BaseContainer, MaxSize >
using Base = BaseContainer
 
using Span = gsl::span< typename Base::value_type >
 
- Static Protected Attributes inherited from kagome::common::SizeLimitedContainer< BaseContainer, MaxSize >
static constexpr bool size_check_is_enabled
 

Detailed Description

Definition at line 21 of file trie_node.hpp.

Member Typedef Documentation

Constructor & Destructor Documentation

kagome::storage::trie::KeyNibbles::KeyNibbles ( common::Buffer  b)
inline

Definition at line 28 of file trie_node.hpp.

Member Function Documentation

static KeyNibbles kagome::storage::trie::KeyNibbles::fromByteBuffer ( const common::BufferView key)
inlinestatic

Def. 14 KeyEncode Splits a key to an array of nibbles (a nibble is a half of a byte) TODO(Harrm): Good candidate to rewrite with SIMD

Definition at line 35 of file trie_node.hpp.

NibblesView kagome::storage::trie::KeyNibbles::subspan ( size_t  offset = 0,
size_t  length = -1 
) const
inline

Definition at line 78 of file trie_node.hpp.

static uint8_t kagome::storage::trie::KeyNibbles::toByte ( uint8_t  high,
uint8_t  low 
)
inlinestatic

Definition at line 74 of file trie_node.hpp.

auto kagome::storage::trie::KeyNibbles::toByteBuffer ( ) const
inline

Collects an array of nibbles to a key TODO(Harrm): Good candidate to rewrite with SIMD

Definition at line 57 of file trie_node.hpp.


The documentation for this struct was generated from the following file: