Sux
Public Member Functions | List of all members
sux::util::Expandable Class Referenceabstract

#include <Expandable.hpp>

Inheritance diagram for sux::util::Expandable:
sux::util::FenwickBitF< BOUND, AT > sux::util::FenwickBitL< BOUND, AT > sux::util::FenwickByteF< BOUND, AT > sux::util::FenwickByteL< BOUND, AT > sux::util::FenwickFixedF< BOUND, AT > sux::util::FenwickFixedL< BOUND, AT > sux::util::Vector< T, AT > sux::util::Vector< int64_t, AT > sux::util::Vector< uint64_t, AT > sux::util::Vector< uint8_t, AT >

Public Member Functions

virtual void reserve (size_t capacity)=0
 
virtual void grow (size_t capacity)=0
 
virtual void resize (size_t size)=0
 
virtual size_t size () const =0
 
virtual void size (size_t size)=0
 
virtual void trim (size_t capacity)=0
 
void trimToFit ()
 

Detailed Description

A generic interface for classes that have size (the current number of elements) and capacity (the number of elements that can be added before a reallocation happens).

Member Function Documentation

◆ grow()

virtual void sux::util::Expandable::grow ( size_t  capacity)
pure virtual

Enlarges this expandable so that it can contain a given number of elements, plus possibly extra space.

If the current capacity is sufficient, nothing happens. Otherwise, the expandable is enlarged, usually to the maximum between the provided capacity and 50% more than the current capacity.

Parameters
capacitythe desired new capacity.

Implemented in sux::util::FenwickByteL< BOUND, AT >, sux::util::FenwickBitL< BOUND, AT >, sux::util::FenwickFixedL< BOUND, AT >, sux::util::FenwickByteF< BOUND, AT >, sux::util::FenwickFixedF< BOUND, AT >, sux::util::FenwickBitF< BOUND, AT >, sux::util::Vector< T, AT >, sux::util::Vector< uint64_t, AT >, sux::util::Vector< uint8_t, AT >, and sux::util::Vector< int64_t, AT >.

◆ reserve()

virtual void sux::util::Expandable::reserve ( size_t  capacity)
pure virtual

Enlarges this expandable so that it can contain a given number of elements without memory reallocation.

If the current capacity is sufficient, nothing happens. Otherwise, the expandable is enlarged to the provided capacity.

Parameters
capacitythe desired new capacity.

Implemented in sux::util::FenwickByteL< BOUND, AT >, sux::util::FenwickBitL< BOUND, AT >, sux::util::FenwickFixedL< BOUND, AT >, sux::util::FenwickByteF< BOUND, AT >, sux::util::FenwickFixedF< BOUND, AT >, sux::util::FenwickBitF< BOUND, AT >, sux::util::Vector< T, AT >, sux::util::Vector< uint64_t, AT >, sux::util::Vector< uint8_t, AT >, and sux::util::Vector< int64_t, AT >.

◆ resize()

virtual void sux::util::Expandable::resize ( size_t  size)
pure virtual

Changes the expandable size to the given value.

If the argument is smaller than or equal to the current size, there is no memory reallocation. Otherwise, reallocation happens with grow().

Parameters
sizethe desired new size.

Implemented in sux::util::FenwickByteL< BOUND, AT >, sux::util::FenwickBitL< BOUND, AT >, sux::util::FenwickFixedL< BOUND, AT >, sux::util::FenwickByteF< BOUND, AT >, sux::util::FenwickBitF< BOUND, AT >, sux::util::FenwickFixedF< BOUND, AT >, sux::util::Vector< T, AT >, sux::util::Vector< uint64_t, AT >, sux::util::Vector< uint8_t, AT >, and sux::util::Vector< int64_t, AT >.

◆ size() [1/2]

virtual size_t sux::util::Expandable::size ( ) const
pure virtual

◆ size() [2/2]

virtual void sux::util::Expandable::size ( size_t  size)
pure virtual

◆ trim()

virtual void sux::util::Expandable::trim ( size_t  capacity)
pure virtual

◆ trimToFit()

void sux::util::Expandable::trimToFit ( )
inline

Trims the the memory allocated so that size and capacity are the same.


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