SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
|
A generic immutable space-saving vector class for unsigned integers. It encodes each integer with its self-delimiting code and still provides constant time access. More...
#include <enc_vector.hpp>
Public Types | |
typedef uint64_t | value_type |
typedef random_access_const_iterator < enc_vector > | iterator |
typedef iterator | const_iterator |
typedef const value_type | reference |
typedef const value_type | const_reference |
typedef const value_type * | const_pointer |
typedef ptrdiff_t | difference_type |
typedef int_vector::size_type | size_type |
typedef Coder | coder |
typedef enc_vector_trait < fixedIntWidth > ::int_vector_type | int_vector_type |
Public Member Functions | |
enc_vector () | |
Default Constuctor. | |
enc_vector (const enc_vector &v) | |
Copy constructor. | |
template<class Container > | |
enc_vector (const Container &c) | |
Constructor for a Container of positive integers. | |
template<uint8_t int_width, class size_type_class > | |
enc_vector (int_vector_file_buffer< int_width, size_type_class > &v_buf) | |
Constructor for an int_vector_file_buffer of positive integers. | |
template<class Container > | |
void | init (const Container &c) |
template<uint8_t int_width, class size_type_class > | |
void | init (int_vector_file_buffer< int_width, size_type_class > &v_buf) |
~enc_vector () | |
Default Destructor. | |
size_type | size () const |
The number of elements in the enc_vector. | |
bool | empty () const |
Returns if the enc_vector is empty. | |
void | swap (enc_vector &v) |
Swap method for enc_vector. | |
const const_iterator | begin () const |
Iterator that points to the first element of the enc_vector. | |
const const_iterator | end () const |
Iterator that points to the position after the last element of the enc_vector. | |
value_type | operator[] (size_type i) const |
[]-operator | |
enc_vector & | operator= (const enc_vector &v) |
Assignment Operator. | |
bool | operator== (const enc_vector &v) const |
Equality Operator. | |
bool | operator!= (const enc_vector &v) const |
Inequality Operator. | |
size_type | serialize (std::ostream &out, structure_tree_node *v=NULL, std::string name="") const |
Serialzes the enc_vector to a stream. | |
void | load (std::istream &in) |
Load the enc_vector from a stream. | |
value_type | sample (const size_type i) const |
Returns the ith sample of enc_vector. | |
uint32_t | get_sample_dens () const |
void | get_inter_sampled_values (const size_type i, uint64_t *it) const |
Static Public Member Functions | |
static size_type | max_size () |
Return the largest size that this container can ever have. | |
Public Attributes | |
int_vector< 0 > | m_z |
Static Public Attributes | |
static const uint32_t | sample_dens = SampleDens |
A generic immutable space-saving vector class for unsigned integers. It encodes each integer with its self-delimiting code and still provides constant time access.
The values of a enc_vector are immutable after the constructor call. The class can be parametrized with a self-delimiting codes (parameter Coder) and the sample density.
This class is a parameter of csa_sada.
sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::enc_vector | ( | const enc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) |
Copy constructor.
v | The enc_vector to copy. Required for the Assignable Concept of the STL |
sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::enc_vector | ( | const Container & | c | ) | [inline] |
Constructor for a Container of positive integers.
c | A container of positive integers. |
const enc_vector< Coder, SampleDens, fixedIntWidth >::const_iterator sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::begin | ( | ) | const |
Iterator that points to the first element of the enc_vector.
Required for the Container Concept of the STL.
bool sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::empty | ( | ) | const [inline] |
Returns if the enc_vector is empty.
Equivalent to size() == 0.
Required for the STL Container Concept.
const enc_vector< Coder, SampleDens, fixedIntWidth >::const_iterator sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::end | ( | ) | const |
Iterator that points to the position after the last element of the enc_vector.
Required for the Container Concept of the STL
void sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::get_inter_sampled_values | ( | const size_type | i, |
uint64_t * | it | ||
) | const [inline] |
i | The index of the sample for which all values till the next sample should be decoded. 0 <= i < size()/get_sample_dens() |
it | A pointer to a uint64_t vector, whereto the values should be written |
enc_vector::size_type sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::max_size | ( | ) | [inline, static] |
Return the largest size that this container can ever have.
Required for the Container Concept of the STL.
bool sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::operator!= | ( | const enc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) | const |
Inequality Operator.
Two enc_vectors are unequal if not all member variables are equal (including the sample density of the enc_vectors).
Required for the Equality Comparable Concept of the STL.
enc_vector< Coder, SampleDens, fixedIntWidth > & sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::operator= | ( | const enc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) |
Assignment Operator.
Required for the Assignable Concept of the STL.
bool sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::operator== | ( | const enc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) | const |
Equality Operator.
Two enc_vectors are equal if all member variables are equal (including the sample density of the enc_vectors).
Required for the Equality Comparable Concept of the STL.
enc_vector< Coder, SampleDens, fixedIntWidth >::value_type sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::operator[] | ( | size_type | i | ) | const [inline] |
[]-operator
i | Index of the value. . |
Required for the STL Random Access Container Concept.
enc_vector< Coder, SampleDens, fixedIntWidth >::value_type sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::sample | ( | const size_type | i | ) | const [inline] |
Returns the ith sample of enc_vector.
i | The index of the sample. 0 <= i < size()/get_sample_dens() |
enc_vector::size_type sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::serialize | ( | std::ostream & | out, |
structure_tree_node * | v = NULL , |
||
std::string | name = "" |
||
) | const |
Serialzes the enc_vector to a stream.
out | Outstream to write the data structure. |
enc_vector::size_type sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::size | ( | ) | const [inline] |
The number of elements in the enc_vector.
Required for the Container Concept of the STL.
void sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::swap | ( | enc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) |
Swap method for enc_vector.
The swap method can be defined in terms of assignment. This requires three assignments, each of which, for a container type, is linear in the container's size. In a sense, then, a.swap(b) is redundant. This implementation guaranties a run-time complexity that is constant rather than linear.
v | enc_vector to swap. |
Required for the Assignable Conecpt of the STL.