SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
shore::intpack Class Reference

Vector for dynamic bit-width integer storage. More...

Classes

class  const_iterator
 iterator proxy class More...
 
class  const_reference
 const reference proxy class. More...
 
class  iterator
 iterator proxy class More...
 
class  reference
 reference proxy class More...
 

Public Types

typedef shore::uint64_t int_type
 The proxied type.
 

Public Member Functions

 intpack (const size_t initialsize=0)
 Constructor; initial values are zero-initialized.
 
 intpack (const intpack &other)
 Copy constructor, calls operator=.
 
intpackoperator= (const intpack &other)
 Assignment: clear(), repack(), resize(), then copy the data.
 
 ~intpack ()
 Destructor; release memory.
 
void resize (const size_t new_size)
 Resize; new values are uninitialized.
 
void repack (size_t new_nbit=std::numeric_limits< size_t >::max())
 Reencode; sets capacity equal to size.
 
void repack_for (int_type v)
 Reencode such that we are able to store v.
 
void reserve (const size_t new_capacity)
 Increase the capacity to accomodate at least the requested number of elements.
 
void clear ()
 Set size to zero.
 
void push_back (const int_type n)
 Add an element.
 
void pop_back ()
 Remove element.
 
template<typename Iter >
void append (Iter beg, Iter end)
 Append elements in range; all elements must be <= max_value.
 
reference operator[] (const size_t idx)
 Access element at position idx.
 
const_reference operator[] (const size_t idx) const
 Access element at position idx.
 
reference front ()
 Access first element.
 
const_reference front () const
 Access first element.
 
reference back ()
 Access last element.
 
const_reference back () const
 Access last element.
 
size_t nbit () const
 Get number of bits per element.
 
size_t size () const
 Get number of elements.
 
bool empty () const
 Test if size==0.
 
int_type max_value () const
 Get the maximum value that can be stored.
 
const char * data_begin () const
 Pointer to the start of the underlying storage.
 
const char * data_end () const
 Pointer to the end of the underlying storage.
 
void end_polish ()
 Set the dummy bytes included by data_end() to zero.
 
iterator begin ()
 Get the (proxy) iterator to the first element.
 
iterator end ()
 Get the (proxy) iterator to the end of the intpack.
 
const_iterator begin () const
 Get the (proxy) iterator to the first element.
 
const_iterator end () const
 Get the (proxy) iterator to the end of the intpack.
 

Static Public Member Functions

static const_iterator iter_at (const char *const data, const size_t nbit, const size_t idx)
 Create an iterator for decoding a character array;. More...
 

Static Public Attributes

static const size_t GROWTH_ATTENUATOR =1
 Lets the container grow by factor 1.5 on resize.
 

Detailed Description

Vector for dynamic bit-width integer storage.

Member Function Documentation

static const_iterator shore::intpack::iter_at ( const char *const  data,
const size_t  nbit,
const size_t  idx 
)
static

Create an iterator for decoding a character array;.

NOTE: data must have at least 7 dummy bytes at the end


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