b-tree-plus-alpha
Loading...
Searching...
No Matches
stool::bptree::DynamicSequence64 Class Reference

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.
 
DynamicSequence64operator= (const DynamicSequence64 &)=delete
 
 DynamicSequence64 (DynamicSequence64 &&) noexcept=default
 
DynamicSequence64operator= (DynamicSequence64 &&) noexcept=default
 
void clear ()
 Clears all elements from the sequence.
 
void verify () const
 Verifies the integrity of the sequence.
 
Treeget_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_tto_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.
 

Detailed Description

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.

Member Function Documentation

◆ at()

uint64_t stool::bptree::DynamicSequence64::at ( uint64_t  pos) const
inline

Returns the value at a specified position in the sequence.

Parameters
posThe position to get the value from.
Returns
The value at the specified position.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ begin()

Tree::ValueForwardIterator stool::bptree::DynamicSequence64::begin ( ) const
inline

Returns an iterator to the beginning of the sequence.

Returns
An iterator to the first element of the sequence.
Here is the call graph for this function:

◆ build()

static DynamicSequence64 stool::bptree::DynamicSequence64::build ( const std::vector< uint64_t > &  items)
inlinestatic

Builds a new sequence from a vector of items.

Parameters
itemsThe vector of items to build the sequence from.
tree_degreeThe degree of the tree.
Returns
A new DynamicSequence64 instance.
Here is the call graph for this function:

◆ build_from_data() [1/2]

static DynamicSequence64 stool::bptree::DynamicSequence64::build_from_data ( const std::vector< uint8_t > &  data,
uint64_t pos 
)
inlinestatic

Builds a sequence from a vector of bytes.

Parameters
dataThe vector of bytes to build the sequence from.
posThe position in the vector to start building from.
Returns
A new DynamicSequence64 instance.
Here is the call graph for this function:

◆ build_from_data() [2/2]

static DynamicSequence64 stool::bptree::DynamicSequence64::build_from_data ( std::ifstream &  ifs)
inlinestatic

Builds a sequence from a file.

Parameters
ifsThe input stream to build the sequence from.
Returns
A new DynamicSequence64 instance.
Here is the call graph for this function:

◆ decrement()

void stool::bptree::DynamicSequence64::decrement ( uint64_t  i,
int64_t  delta 
)
inline

Decrements the value at a specified position by a given delta.

Parameters
iThe position to decrement.
deltaThe amount to decrement by.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ end()

Tree::ValueForwardIterator stool::bptree::DynamicSequence64::end ( ) const
inline

Returns an iterator to the end of the sequence.

Returns
An iterator to the element following the last element of the sequence.
Here is the call graph for this function:

◆ get_degree()

uint64_t stool::bptree::DynamicSequence64::get_degree ( ) const
inline

Returns the degree of the tree.

Returns
The degree of the tree.
Here is the call graph for this function:

◆ get_memory_usage_info()

std::vector< std::string > stool::bptree::DynamicSequence64::get_memory_usage_info ( int  message_paragraph = stool::Message::SHOW_MESSAGE) const
inline

Returns information about the memory usage of the sequence.

Parameters
message_paragraphThe paragraph level for the message.
Returns
A vector of strings containing memory usage information.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_tree()

Tree & stool::bptree::DynamicSequence64::get_tree ( )
inline

Returns a reference to the underlying tree.

Returns
A reference to the tree.

◆ increment()

void stool::bptree::DynamicSequence64::increment ( uint64_t  i,
int64_t  delta 
)
inline

Increments the value at a specified position by a given delta.

Parameters
iThe position to increment.
deltaThe amount to increment by.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert()

void stool::bptree::DynamicSequence64::insert ( uint64_t  pos,
uint64_t  value 
)
inline

Inserts a value at a specified position in the sequence.

Parameters
posThe position to insert the value at.
valueThe value to insert.
Here is the call graph for this function:

◆ name()

static std::string stool::bptree::DynamicSequence64::name ( )
inlinestatic

Returns the name of the sequence.

Returns
A string representing the name of the sequence.

◆ operator[]()

uint64_t stool::bptree::DynamicSequence64::operator[] ( uint64_t  n) const
inline

Returns the value at a specified position in the sequence.

Parameters
nThe position to get the value from.
Returns
The value at the specified position.
Here is the call graph for this function:

◆ print_memory_usage()

void stool::bptree::DynamicSequence64::print_memory_usage ( int  message_paragraph = stool::Message::SHOW_MESSAGE) const
inline

Prints the memory usage of the sequence.

Parameters
message_paragraphThe paragraph level for the message.
Here is the call graph for this function:

◆ print_statistics()

void stool::bptree::DynamicSequence64::print_statistics ( int  message_paragraph = stool::Message::SHOW_MESSAGE) const
inline

Prints statistics about the sequence.

Parameters
message_paragraphThe paragraph level for the message.
Here is the call graph for this function:

◆ push_back()

void stool::bptree::DynamicSequence64::push_back ( int64_t  value)
inline

Adds an element to the end of the sequence.

Parameters
valueThe value to add.
Here is the call graph for this function:

◆ push_front()

void stool::bptree::DynamicSequence64::push_front ( int64_t  value)
inline

Adds an element to the beginning of the sequence.

Parameters
valueThe value to add.
Here is the call graph for this function:

◆ push_many()

void stool::bptree::DynamicSequence64::push_many ( const std::vector< uint64_t > &  items)
inline

Adds multiple elements to the end of the sequence.

Parameters
itemsThe vector of items to add.
Here is the call graph for this function:

◆ remove()

void stool::bptree::DynamicSequence64::remove ( uint64_t  pos)
inline

Removes the element at a specified position from the sequence.

Parameters
posThe position of the element to remove.
Here is the call graph for this function:

◆ save() [1/2]

static void stool::bptree::DynamicSequence64::save ( DynamicSequence64 item,
std::ofstream &  os 
)
inlinestatic

Saves the sequence to a file.

Parameters
itemThe sequence to save.
osThe output stream to save the sequence to.
Here is the call graph for this function:

◆ save() [2/2]

static void stool::bptree::DynamicSequence64::save ( DynamicSequence64 item,
std::vector< uint8_t > &  output,
uint64_t pos 
)
inlinestatic

Saves the sequence to a vector of bytes.

Parameters
itemThe sequence to save.
outputThe vector to save the sequence to.
posThe position in the vector to start saving at.
Here is the call graph for this function:

◆ set_value()

void stool::bptree::DynamicSequence64::set_value ( uint64_t  pos,
uint64_t  value 
)
inline

Sets the value at a specified position in the sequence.

Parameters
posThe position to set the value at.
valueThe new value to set.
Here is the call graph for this function:

◆ size()

uint64_t stool::bptree::DynamicSequence64::size ( ) const
inline

Returns the number of elements in the sequence.

Returns
The size of the sequence.
Here is the call graph for this function:

◆ size_in_bytes()

uint64_t stool::bptree::DynamicSequence64::size_in_bytes ( ) const
inline

Returns the size of the sequence in bytes.

Returns
The size of the sequence in bytes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap()

void stool::bptree::DynamicSequence64::swap ( DynamicSequence64 item)
inline

Swaps the contents of this sequence with another.

Parameters
itemThe sequence to swap with.
Here is the call graph for this function:

◆ to_string()

std::string stool::bptree::DynamicSequence64::to_string ( ) const
inline

Converts the sequence to a string.

Returns
A string representation of the sequence.
Here is the call graph for this function:

◆ to_vector()

std::vector< uint64_t > stool::bptree::DynamicSequence64::to_vector ( ) const
inline

Converts the sequence to a vector.

Returns
A vector containing the elements of the sequence.
Here is the call graph for this function:
Here is the caller graph for this function:

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