SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
|
A generic immutable space-saving vector class for unsigned positive integers. More...
#include <vlc_vector.hpp>
Public Types | |
typedef uint64_t | value_type |
typedef random_access_const_iterator < vlc_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 vlc_vector_trait < fixedIntWidth > ::int_vector_type | int_vector_type |
Public Member Functions | |
vlc_vector () | |
Default Constuctor. | |
vlc_vector (const vlc_vector &v) | |
Copy constructor. | |
template<class Container > | |
vlc_vector (const Container &c) | |
Constructor for a Container of positive integers. | |
template<uint8_t int_width, class size_type_class > | |
vlc_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) |
~vlc_vector () | |
Default Destructor. | |
size_type | size () const |
The number of elements in the vlc_vector. | |
bool | empty () const |
Returns if the vlc_vector is empty. | |
void | swap (vlc_vector &v) |
Swap method for vlc_vector. | |
const const_iterator | begin () const |
Iterator that points to the first element of the vlc_vector. | |
const const_iterator | end () const |
Iterator that points to the position after the last element of the vlc_vector. | |
value_type | operator[] (size_type i) const |
[]-operator | |
vlc_vector & | operator= (const vlc_vector &v) |
Assignment Operator. | |
bool | operator== (const vlc_vector &v) const |
Equality Operator. | |
bool | operator!= (const vlc_vector &v) const |
Unequality Operator. | |
size_type | serialize (std::ostream &out) const |
Serialzes the vlc_vector to a stream. | |
void | load (std::istream &in) |
Load the vlc_vector from a stream. | |
value_type | sample (const size_type i) const |
Returns the ith sample of vlc_vector. | |
uint32_t | get_sample_dens () const |
void | set_sample_dens (const uint32_t sample_dens) |
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 positive integers.
The values of a vlc_vector are immutable after the constructor call. The class could be parametrized with a self-delimiting code Coder and the sample density.
sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::vlc_vector | ( | const vlc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) |
Copy constructor.
v | The vlc_vector to copy. Required for the Assignable Concept of the STL |
sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::vlc_vector | ( | const Container & | c | ) | [inline] |
Constructor for a Container of positive integers.
c | A container of positive integers. |
const vlc_vector< Coder, SampleDens, fixedIntWidth >::const_iterator sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::begin | ( | ) | const |
Iterator that points to the first element of the vlc_vector.
Required for the Container Concept of the STL.
bool sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::empty | ( | ) | const [inline] |
Returns if the vlc_vector is empty.
Equivalent to size() == 0.
Required for the STL Container Concept.
const vlc_vector< Coder, SampleDens, fixedIntWidth >::const_iterator sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::end | ( | ) | const |
Iterator that points to the position after the last element of the vlc_vector.
Required for the Container Concept of the STL
vlc_vector::size_type sdsl::vlc_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::vlc_vector< Coder, SampleDens, fixedIntWidth >::operator!= | ( | const vlc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) | const |
Unequality Operator.
Two vlc_vectors are unuequal if not all member variables are equal (including the sample density of the vlc_vectors).
Required for the Equality Comparable Concept of the STL.
vlc_vector< Coder, SampleDens, fixedIntWidth > & sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::operator= | ( | const vlc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) |
Assignment Operator.
Required for the Assignable Concept of the STL.
bool sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::operator== | ( | const vlc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) | const |
Equality Operator.
Two vlc_vectors are equal if all member variables are equal (including the sample density of the vlc_vectors).
Required for the Equality Comparable Concept of the STL.
vlc_vector< Coder, SampleDens, fixedIntWidth >::value_type sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::operator[] | ( | size_type | i | ) | const [inline] |
[]-operator
i | Index of the value. . |
Required for the STL Random Access Container Concept.
value_type sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::sample | ( | const size_type | i | ) | const |
Returns the ith sample of vlc_vector.
i | The index of the sample. 0 <= i < size()/get_sample_dens() |
vlc_vector::size_type sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::serialize | ( | std::ostream & | out | ) | const |
Serialzes the vlc_vector to a stream.
out | Outstream to write the data structure. |
vlc_vector::size_type sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::size | ( | ) | const [inline] |
The number of elements in the vlc_vector.
Required for the Container Concept of the STL.
void sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::swap | ( | vlc_vector< Coder, SampleDens, fixedIntWidth > & | v | ) |
Swap method for vlc_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 | vlc_vector to swap. |
Required for the Assignable Conecpt of the STL.