Grok 20.3.2
grk::SequentialCache< T > Class Template Reference

Dynamic array of pointers of type T. More...

#include <SequentialCache.h>

Public Member Functions

 SequentialCache (void)
 Constructs a SequentialCache.
 SequentialCache (uint64_t maxChunkSize)
 Constructs a SequentialCache.
virtual ~SequentialCache (void)
 Destroys a SequentialCache.
void rewind (void)
 Rewinds state of cache, in order to read from beginning.
T * next ()
 Gets next pointer in cache.

Protected Member Functions

virtual T * create (void)

Private Attributes

std::vector< T ** > chunks
T ** currChunk_
uint64_t chunkSize_
uint64_t index_
bool firstElement_

Static Private Attributes

static constexpr uint64_t kSequentialChunkSize = 1024

Detailed Description

template<typename T>
class grk::SequentialCache< T >

Dynamic array of pointers of type T.

This class uses a hybrid design : combination of std::vector and simple array

Template Parameters
Tpointer type

Constructor & Destructor Documentation

◆ SequentialCache() [1/2]

template<typename T>
grk::SequentialCache< T >::SequentialCache ( void )
inline

Constructs a SequentialCache.

References kSequentialChunkSize, and SequentialCache().

Referenced by SequentialCache().

◆ SequentialCache() [2/2]

template<typename T>
grk::SequentialCache< T >::SequentialCache ( uint64_t maxChunkSize)
inline

Constructs a SequentialCache.

Parameters
maxChunkSizemaximum chunk size

References chunkSize_, currChunk_, firstElement_, index_, and kSequentialChunkSize.

◆ ~SequentialCache()

template<typename T>
virtual grk::SequentialCache< T >::~SequentialCache ( void )
inlinevirtual

Destroys a SequentialCache.

References chunks, and chunkSize_.

Member Function Documentation

◆ create()

template<typename T>
virtual T * grk::SequentialCache< T >::create ( void )
inlineprotectedvirtual

Referenced by next().

◆ next()

template<typename T>
T * grk::SequentialCache< T >::next ( )
inline

Gets next pointer in cache.

References chunks, chunkSize_, create(), currChunk_, firstElement_, and index_.

◆ rewind()

template<typename T>
void grk::SequentialCache< T >::rewind ( void )
inline

Rewinds state of cache, in order to read from beginning.

References chunks, currChunk_, firstElement_, and index_.

Member Data Documentation

◆ chunks

template<typename T>
std::vector<T**> grk::SequentialCache< T >::chunks
private

Referenced by next(), rewind(), and ~SequentialCache().

◆ chunkSize_

template<typename T>
uint64_t grk::SequentialCache< T >::chunkSize_
private

◆ currChunk_

template<typename T>
T** grk::SequentialCache< T >::currChunk_
private

Referenced by next(), rewind(), and SequentialCache().

◆ firstElement_

template<typename T>
bool grk::SequentialCache< T >::firstElement_
private

Referenced by next(), rewind(), and SequentialCache().

◆ index_

template<typename T>
uint64_t grk::SequentialCache< T >::index_
private

Referenced by next(), rewind(), and SequentialCache().

◆ kSequentialChunkSize

template<typename T>
uint64_t grk::SequentialCache< T >::kSequentialChunkSize = 1024
staticconstexprprivate

Referenced by SequentialCache(), and SequentialCache().


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