b-tree-plus-alpha
|
A dynamic data structure that maintains a sequence of 64-bit non-negative integers. More...
#include <dynamic_sequence64.hpp>
Public Types | |
using | NodePointer = bptree::BPNodePointer< VLCDeque, uint64_t, bptree::DEFAULT_MAX_DEGREE_OF_INTERNAL_NODE > |
using | Tree = bptree::BPTree< VLCDeque, uint64_t, false, false, bptree::DEFAULT_MAX_DEGREE_OF_INTERNAL_NODE, bptree::DEFAULT_MAX_COUNT_OF_VALUES_IN_LEAF > |
Public Member Functions | |
Tree::ValueForwardIterator | begin () const |
Returns an iterator to the beginning of the sequence. | |
Tree::ValueForwardIterator | end () const |
Returns an iterator to the end of the sequence. | |
DynamicSequence64 () | |
Default constructor initializes the tree with a default degree. | |
void | swap (DynamicSequence64 &item) |
Swaps the contents of this sequence with another. | |
DynamicSequence64 & | operator= (const DynamicSequence64 &)=delete |
DynamicSequence64 (DynamicSequence64 &&) noexcept=default | |
DynamicSequence64 & | operator= (DynamicSequence64 &&) noexcept=default |
void | clear () |
Clears all elements from the sequence. | |
void | verify () const |
Verifies the integrity of the sequence. | |
Tree & | get_tree () |
Returns a reference to the underlying tree. | |
uint64_t | get_degree () const |
Returns the degree of the tree. | |
uint64_t | size () const |
Returns the number of elements in the sequence. | |
void | push_back (int64_t value) |
Adds an element to the end of the sequence. | |
void | push_front (int64_t value) |
Adds an element to the beginning of the sequence. | |
void | insert (uint64_t pos, uint64_t value) |
Inserts a value at a specified position in the sequence. | |
void | remove (uint64_t pos) |
Removes the element at a specified position from the sequence. | |
std::vector< uint64_t > | to_vector () const |
Converts the sequence to a vector. | |
uint64_t | at (uint64_t pos) const |
Returns the value at a specified position in the sequence. | |
void | set_value (uint64_t pos, uint64_t value) |
Sets the value at a specified position in the sequence. | |
void | increment (uint64_t i, int64_t delta) |
Increments the value at a specified position by a given delta. | |
void | decrement (uint64_t i, int64_t delta) |
Decrements the value at a specified position by a given delta. | |
void | push_many (const std::vector< uint64_t > &items) |
Adds multiple elements to the end of the sequence. | |
uint64_t | size_in_bytes () const |
Returns the size of the sequence in bytes. | |
std::vector< std::string > | get_memory_usage_info (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
Returns information about the memory usage of the sequence. | |
void | print_memory_usage (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
Prints the memory usage of the sequence. | |
void | print_statistics (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
Prints statistics about the sequence. | |
uint64_t | operator[] (uint64_t n) const |
Returns the value at a specified position in the sequence. | |
std::string | to_string () const |
Converts the sequence to a string. | |
void | print () const |
Prints the sequence to the console. | |
Static Public Member Functions | |
static DynamicSequence64 | build (const std::vector< uint64_t > &items) |
Builds a new sequence from a vector of items. | |
static std::string | name () |
Returns the name of the sequence. | |
static void | save (DynamicSequence64 &item, std::vector< uint8_t > &output, uint64_t &pos) |
Saves the sequence to a vector of bytes. | |
static void | save (DynamicSequence64 &item, std::ofstream &os) |
Saves the sequence to a file. | |
static DynamicSequence64 | build_from_data (const std::vector< uint8_t > &data, uint64_t &pos) |
Builds a sequence from a vector of bytes. | |
static DynamicSequence64 | build_from_data (std::ifstream &ifs) |
Builds a sequence from a file. | |
A dynamic data structure that maintains a sequence of 64-bit non-negative integers.
This class provides a dynamic sequence of 64-bit non-negative integers with operations for insertion, deletion, and modification.
Returns the value at a specified position in the sequence.
pos | The position to get the value from. |
|
inline |
Returns an iterator to the beginning of the sequence.
|
inlinestatic |
Builds a new sequence from a vector of items.
items | The vector of items to build the sequence from. |
tree_degree | The degree of the tree. |
|
inlinestatic |
Builds a sequence from a vector of bytes.
data | The vector of bytes to build the sequence from. |
pos | The position in the vector to start building from. |
|
inlinestatic |
Builds a sequence from a file.
ifs | The input stream to build the sequence from. |
Decrements the value at a specified position by a given delta.
i | The position to decrement. |
delta | The amount to decrement by. |
|
inline |
Returns an iterator to the end of the sequence.
|
inline |
Returns the degree of the tree.
|
inline |
Returns information about the memory usage of the sequence.
message_paragraph | The paragraph level for the message. |
|
inline |
Returns a reference to the underlying tree.
Increments the value at a specified position by a given delta.
i | The position to increment. |
delta | The amount to increment by. |
Inserts a value at a specified position in the sequence.
pos | The position to insert the value at. |
value | The value to insert. |
|
inlinestatic |
Returns the name of the sequence.
Returns the value at a specified position in the sequence.
n | The position to get the value from. |
|
inline |
Prints the memory usage of the sequence.
message_paragraph | The paragraph level for the message. |
|
inline |
Prints statistics about the sequence.
message_paragraph | The paragraph level for the message. |
Adds an element to the end of the sequence.
value | The value to add. |
Adds an element to the beginning of the sequence.
value | The value to add. |
Adds multiple elements to the end of the sequence.
items | The vector of items to add. |
Removes the element at a specified position from the sequence.
pos | The position of the element to remove. |
|
inlinestatic |
Saves the sequence to a file.
item | The sequence to save. |
os | The output stream to save the sequence to. |
|
inlinestatic |
Saves the sequence to a vector of bytes.
item | The sequence to save. |
output | The vector to save the sequence to. |
pos | The position in the vector to start saving at. |
Sets the value at a specified position in the sequence.
pos | The position to set the value at. |
value | The new value to set. |
|
inline |
Returns the number of elements in the sequence.
|
inline |
Returns the size of the sequence in bytes.
|
inline |
Swaps the contents of this sequence with another.
item | The sequence to swap with. |
|
inline |
Converts the sequence to a string.
|
inline |
Converts the sequence to a vector.