My Project 3.2.0
C++ Distributed Hash Table
|
A blob structure which prefixes a Key in the PHT. More...
#include <pht.h>
Public Member Functions | |
Prefix (InfoHash h) | |
Prefix (const Blob &d, const Blob &f={}) | |
Prefix (const Prefix &p, size_t first) | |
Prefix | getPrefix (ssize_t len) const |
bool | isFlagActive (size_t pos) const |
bool | isContentBitActive (size_t pos) const |
Prefix | getFullSize () |
Prefix | getSibling () const |
InfoHash | hash () const |
void | swapContentBit (size_t bit) |
void | swapFlagBit (size_t bit) |
void | addPaddingContent (size_t size) |
void | updateFlags () |
std::string | toString () const |
Static Public Member Functions | |
static unsigned | commonBits (const Prefix &p1, const Prefix &p2) |
Public Attributes | |
size_t | size_ {0} |
Blob | flags_ {} |
Blob | content_ {} |
A blob structure which prefixes a Key in the PHT.
Since the PHT structure is a "trie", every node in this structure have a label which is defined by the path from the root of the trie to the node. If the node in question is a leaf, the label is a prefix of all the keys contained in the leaf.
|
inline |
|
inline |
|
inline |
Get a sub prefix of the Prefix
len | lenght of the prefix to get, could be negative if len is negativ then you will get the prefix of size of the previous prefix minus len |
out_of_range | if len is larger than size of the content |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |