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::vlc_vector< Coder, SampleDens, fixedIntWidth > Class Template Reference

A generic immutable space-saving vector class for unsigned positive integers. More...

#include <vlc_vector.hpp>

List of all members.

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

Detailed Description

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

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.


Constructor & Destructor Documentation

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

Copy constructor.

Parameters:
vThe vlc_vector to copy. Required for the Assignable Concept of the STL
template<class Coder = coder::elias_delta, uint32_t SampleDens = 16, uint8_t fixedIntWidth = 0>
template<class Container >
sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::vlc_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 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.
See also:
end()
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.
See also:
size()
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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
See also:
begin()
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.

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

Note:
If the sample density is not equal you should use SDSAlgorithm::equal_container_values to compare two vlc_vectors.
  Required for the Equality Comparable Concept of the STL.
See also:
operator==
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
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.

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

Note:
If the sample density is not equal you should use SDSAlgorithm::equal_container_values to compare two vlc_vectors.
  Required for the Equality Comparable Concept of the STL.
See also:
operator!=
template<class Coder , uint32_t SampleDens, uint8_t fixedIntWidth>
vlc_vector< Coder, SampleDens, fixedIntWidth >::value_type sdsl::vlc_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 = coder::elias_delta, uint32_t SampleDens = 16, uint8_t fixedIntWidth = 0>
value_type sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::sample ( const size_type  i) const

Returns the ith sample of vlc_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>
vlc_vector::size_type sdsl::vlc_vector< Coder, SampleDens, fixedIntWidth >::serialize ( std::ostream &  out) const

Serialzes the vlc_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>
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.

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

Parameters:
vvlc_vector to swap.

Required for the Assignable Conecpt of the STL.


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