9#ifndef INCLUDED_SDSL_SORTED_MULTI_STACK_SUPPORT
10#define INCLUDED_SDSL_SORTED_MULTI_STACK_SUPPORT
47 bool empty()
const {
return 0 == m_cnt; };
72 void load(std::istream & in);
73 template <
typename archive_t>
75 template <
typename archive_t>
84 , m_duplication_stack()
100 if (0 == ((m_stack[bn] >> block_pos(x)) & 1))
102 m_stack[bn] ^= (1ULL << block_pos(x));
103 if (bn > 0 and m_stack[bn - 1] == 0) { m_stack[bn - 1] = 0x8000000000000000ULL | m_top; }
113 m_duplication_stack[m_cnt >> 6] ^= (1ULL << (m_cnt & 0x3F));
124 if ((m_duplication_stack[m_cnt >> 6] >> (m_cnt & 0x3F)) & 1)
126 m_duplication_stack[m_cnt >> 6] ^= (1ULL << (m_cnt & 0x3F));
132 uint64_t w = m_stack[bn];
133 assert((w >> 63) == 0);
134 w ^= (1ULL << block_pos(m_top));
136 if (w > 0) { m_top = bn * 63 +
bits::hi(w); }
144 m_top = (bn - 1) * 63 +
bits::hi(w);
149 m_top = w & 0x7FFFFFFFFFFFFFFFULL;
160 std::string name)
const
168 written_bytes += m_duplication_stack.
serialize(out);
170 return written_bytes;
179 m_duplication_stack.
load(in);
182template <
typename archive_t>
192template <
typename archive_t>
A generic vector class for integers of width .
void load(std::istream &in)
Load the int_vector for a stream.
size_type serialize(std::ostream &out, structure_tree_node *v=nullptr, std::string name="") const
Serializes the int_vector to a stream.
Stack which contains elements from [0..n] in sorted order. Duplicates are possible.
int_vector< 64 >::size_type size_type
size_type size() const
Returns the number of element is the stack.
void CEREAL_LOAD_FUNCTION_NAME(archive_t &ar)
sorted_multi_stack_support(sorted_multi_stack_support &&)=default
sorted_multi_stack_support(size_type n)
Constructor.
void CEREAL_SAVE_FUNCTION_NAME(archive_t &ar) const
size_type serialize(std::ostream &out, structure_tree_node *v=nullptr, std::string name="") const
void load(std::istream &in)
sorted_multi_stack_support(const sorted_multi_stack_support &)=default
bool empty() const
Returns if the stack is empty.
size_type top() const
Returns the topmost index on the stack.
sorted_multi_stack_support & operator=(const sorted_multi_stack_support &)=default
sorted_multi_stack_support & operator=(sorted_multi_stack_support &&)=default
bool pop()
Pop the topmost index of the stack.
bool push(size_type x)
Push the index x of vector vec onto the stack.
static structure_tree_node * add_child(structure_tree_node *v, const std::string &name, const std::string &type)
static void add_size(structure_tree_node *v, uint64_t value)
int_vector.hpp contains the sdsl::int_vector class.
Namespace for the succinct data structure library.
size_t write_member(const T &t, std::ostream &out, sdsl::structure_tree_node *v=nullptr, std::string name="")
void read_member(T &t, std::istream &in)
static constexpr uint32_t hi(uint64_t x)
Position of the most significant set bit the 64-bit word x.