Skip to content

Class QAccelPlot::LineCurveVertexCache

ClassList > QAccelPlot > LineCurveVertexCache

Owns a LineCurve 's pre-built vertex bytes and the metadata required to use them safely.More...

  • #include <LineCurveVertexCache.hpp>

Public Types

Type Name
enum Layout
Renderer geometry represented by the cached bytes.
typedef std::function< void(std::vector< char > &bytes, int firstPoint)> Writer
Function that writes the vertices of the points from firstPoint on into__bytes , which is sized for all points.

Public Functions

Type Name
const std::vector< char > & bytes () noexcept const
Returns the owned byte buffer, including retained invalid storage.
void clear () noexcept
Removes all cached bytes and resets the compatibility metadata.
const std::vector< char > * data () noexcept const
Returns the cached bytes when valid, or nullptr otherwise.
void invalidate () noexcept
Marks the cache unusable while retaining its byte allocation.
bool isReusableForDataChange (Layout requiredLayout, int pointCount) noexcept const
Returns whether this cache can survive a data change with the requested layout.
Layout layout () noexcept const
Returns the renderer geometry represented by the cache.
int pointCount () noexcept const
Returns the point count associated with the cache.
void update (Layout layout, int pointCount, std::size_t bytesPerPoint, const Writer & writer)
Sizes the cache for pointCount points of__bytesPerPoint bytes and writes the points it lacks with__writer .
bool valid () noexcept const
Returns whether the cache contains compatible, usable data.

Detailed Description

A cache is valid only for the vertex layout and point count recorded when it was last updated. A vertex depends only on its point index, so an update to a new point count keeps the cached points and writes only the added ones. Invalidating a cache preserves its allocation for reuse; clearing it also releases the stored bytes.

Public Types Documentation

enum Layout

Renderer geometry represented by the cached bytes.

enum QAccelPlot::LineCurveVertexCache::Layout {
    None,
    Line,
    Points
};


typedef Writer

Function that writes the vertices of the points from firstPoint on into__bytes , which is sized for all points.

using QAccelPlot::LineCurveVertexCache::Writer =  std::function<void(std::vector<char>& bytes, int firstPoint)>;


Public Functions Documentation

function bytes

Returns the owned byte buffer, including retained invalid storage.

const std::vector< char > & QAccelPlot::LineCurveVertexCache::bytes () noexcept const


function clear

Removes all cached bytes and resets the compatibility metadata.

void QAccelPlot::LineCurveVertexCache::clear () noexcept


function data

Returns the cached bytes when valid, or nullptr otherwise.

const std::vector< char > * QAccelPlot::LineCurveVertexCache::data () noexcept const


function invalidate

Marks the cache unusable while retaining its byte allocation.

void QAccelPlot::LineCurveVertexCache::invalidate () noexcept


function isReusableForDataChange

Returns whether this cache can survive a data change with the requested layout.

bool QAccelPlot::LineCurveVertexCache::isReusableForDataChange (
    Layout requiredLayout,
    int pointCount
) noexcept const

Solid-line and marker cache vertices contain no XY values and can therefore be reused when the point count remains unchanged.


function layout

Returns the renderer geometry represented by the cache.

Layout QAccelPlot::LineCurveVertexCache::layout () noexcept const


function pointCount

Returns the point count associated with the cache.

int QAccelPlot::LineCurveVertexCache::pointCount () noexcept const


function update

Sizes the cache for pointCount points of__bytesPerPoint bytes and writes the points it lacks with__writer .

void QAccelPlot::LineCurveVertexCache::update (
    Layout layout,
    int pointCount,
    std::size_t bytesPerPoint,
    const Writer & writer
) 

A valid cache with the same layout and bytesPerPoint keeps its points, so writer writes only the points past its previous point count, or none. Otherwise writer writes all points. A layout of None, or a zero pointCount or bytesPerPoint, invalidates the cache.


function valid

Returns whether the cache contains compatible, usable data.

bool QAccelPlot::LineCurveVertexCache::valid () noexcept const



The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/series/LineCurveVertexCache.hpp