Loading...
Searching...
No Matches
Vdf_WeightSlotArray Class Reference

Array of weight slots for weighted iterators. More...

#include <weightedIterator.h>

Public Types

using value_type = Vdf_WeightSlot
 
using reference = Vdf_WeightSlot &
 
using const_reference = const Vdf_WeightSlot &
 
using iterator = Vdf_WeightSlot *
 
using const_iterator = const Vdf_WeightSlot *
 

Public Member Functions

 Vdf_WeightSlotArray ()
 Construct an empty array.
 
 ~Vdf_WeightSlotArray ()
 Destructor.
 
void Allocate (uint32_t numInputs)
 Allocate storage for numInputs elements.
 
size_t size () const
 Return the number of slots in the array.
 
iterator begin ()
 Return an iterator to the first slot in the array.
 
iterator end ()
 Return an iterator to the end of the array.
 
const_iterator begin () const
 Return an iterator to the first slot in the array.
 
const_iterator end () const
 Return an iterator to the end of the array.
 
reference operator[] (size_t slot)
 Access the slot at index slot.
 
const_reference operator[] (size_t slot) const
 Access the slot at index slot.
 
int AdvanceToNextExplicitIndex (int index)
 Returns the next index that has a weight at or after index.
 

Detailed Description

Array of weight slots for weighted iterators.

Inline storage is provided for one weight slot to avoid heap allocation in the common case. However, the local storage and remote storage pointer are not overlapped as this results in undesirable overhead when accessing elements. Iterators are almost always stack allocated and VdfWeightedIterator is non-copyable making compactness less valuable.

Definition at line 46 of file weightedIterator.h.

Member Typedef Documentation

◆ const_iterator

using const_iterator = const Vdf_WeightSlot *

Definition at line 56 of file weightedIterator.h.

◆ const_reference

Definition at line 54 of file weightedIterator.h.

◆ iterator

Definition at line 55 of file weightedIterator.h.

◆ reference

Definition at line 53 of file weightedIterator.h.

◆ value_type

Definition at line 52 of file weightedIterator.h.

Constructor & Destructor Documentation

◆ Vdf_WeightSlotArray()

Vdf_WeightSlotArray ( )
inline

Construct an empty array.

Definition at line 60 of file weightedIterator.h.

◆ ~Vdf_WeightSlotArray()

~Vdf_WeightSlotArray ( )
inline

Destructor.

Definition at line 67 of file weightedIterator.h.

Member Function Documentation

◆ AdvanceToNextExplicitIndex()

int AdvanceToNextExplicitIndex ( int  index)
inline

Returns the next index that has a weight at or after index.

Updates the currentIndex.

Definition at line 474 of file weightedIterator.h.

◆ Allocate()

void Allocate ( uint32_t  numInputs)
inline

Allocate storage for numInputs elements.

This function may only be called once during the lifetime of the array. The size of the array is fixed the first time it is allocated. Elements in the array are uninitialized.

Definition at line 79 of file weightedIterator.h.

◆ begin() [1/2]

iterator begin ( )
inline

Return an iterator to the first slot in the array.

Definition at line 98 of file weightedIterator.h.

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Return an iterator to the first slot in the array.

Definition at line 110 of file weightedIterator.h.

◆ end() [1/2]

iterator end ( )
inline

Return an iterator to the end of the array.

Definition at line 104 of file weightedIterator.h.

◆ end() [2/2]

const_iterator end ( ) const
inline

Return an iterator to the end of the array.

Definition at line 116 of file weightedIterator.h.

◆ operator[]() [1/2]

reference operator[] ( size_t  slot)
inline

Access the slot at index slot.

Definition at line 122 of file weightedIterator.h.

◆ operator[]() [2/2]

const_reference operator[] ( size_t  slot) const
inline

Access the slot at index slot.

Definition at line 128 of file weightedIterator.h.

◆ size()

size_t size ( ) const
inline

Return the number of slots in the array.

Definition at line 92 of file weightedIterator.h.


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