SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
 All Classes Namespaces Files Functions Variables Typedefs Friends
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes
sdsl::enc_vector< Coder, SampleDens, fixedIntWidth > Class Template Reference

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>

List of all members.

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_vectoroperator= (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

Detailed Description

template<class Coder = coder::elias_delta, uint32_t SampleDens = 8, uint8_t fixedIntWidth = 0>
class sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >

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.


Constructor & Destructor Documentation

template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::enc_vector ( const enc_vector< Coder, SampleDens, fixedIntWidth > &  v)

Copy constructor.

Parameters:
vThe enc_vector to copy. Required for the Assignable Concept of the STL
template<class Coder = coder::elias_delta, uint32_t SampleDens = 8, uint8_t fixedIntWidth = 0>
template<class Container >
sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::enc_vector ( const Container &  c) [inline]

Constructor for a Container of positive integers.

Parameters:
cA container of positive integers.
Precondition:
No two adjacent values should be equal.

Member Function Documentation

template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.
See also:
end()
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.
See also:
size()
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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
See also:
begin()
template<class Coder = coder::elias_delta, uint32_t SampleDens = 8, uint8_t fixedIntWidth = 0>
void sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::get_inter_sampled_values ( const size_type  i,
uint64_t *  it 
) const [inline]
Parameters:
iThe index of the sample for which all values till the next sample should be decoded. 0 <= i < size()/get_sample_dens()
itA pointer to a uint64_t vector, whereto the values should be written
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.

template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.
See also:
operator==
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.

template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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).

Note:
If the sample density is not equal you should use SDSAlgorithm::equal_container_values to compare two enc_vectors.
  Required for the Equality Comparable Concept of the STL.
See also:
operator!=
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
enc_vector< Coder, SampleDens, fixedIntWidth >::value_type sdsl::enc_vector< Coder, SampleDens, fixedIntWidth >::operator[] ( size_type  i) const [inline]

[]-operator

Parameters:
iIndex of the value. $ i \in [0..size()-1]$.

Required for the STL Random Access Container Concept.

template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.

Parameters:
iThe index of the sample. 0 <= i < size()/get_sample_dens()
Returns:
The value of the ith sample.
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.

Parameters:
outOutstream to write the data structure.
Returns:
The number of written bytes.
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.

See also:
max_size
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.

Parameters:
venc_vector to swap.

Required for the Assignable Conecpt of the STL.


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