MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kakshya::FrameView Class Reference

Zero-copy typed view over one frame of container storage. More...

#include <NDData.hpp>

+ Collaboration diagram for MayaFlux::Kakshya::FrameView:

Public Member Functions

template<DataVariantElement T>
std::span< const T > as () const
 Return a typed span over the frame data without conversion.
 
std::type_index element_type () const
 Runtime query for the native element type of this frame.
 
bool empty () const
 Returns true if the view holds no elements.
 
 FrameView ()=default
 Construct an empty FrameView.
 
 FrameView (DataSpanVariant span)
 Construct from a DataSpanVariant produced by get_frame_span_impl().
 
const DataSpanVariantraw () const
 Direct access to the underlying DataSpanVariant for internal use.
 
size_t size () const
 Number of elements in the frame, in units of the native element type.
 

Private Attributes

DataSpanVariant m_span
 

Detailed Description

Zero-copy typed view over one frame of container storage.

FrameView is the return type of NDDataContainer::get_frame(). It holds a DataSpanVariant — a span into the container's live storage — without copying or converting data. The active span alternative matches the container's native element type: uint8_t for 8-bit image and video, uint16_t for 16-bit image, float for HDR image, double for audio.

Callers retrieve typed data via as(), which returns an empty span on type mismatch rather than throwing. element_type() provides a runtime query for callers whose branch depends on the native type.

Lifetime
The span inside FrameView points directly into the owning container's internal buffer. It is valid only for the duration of the current processing turn. FrameView must not be stored across buffer cycles, frame callbacks, or any point at which the container may write new data.
Threading
FrameView is not thread-safe. The container's read lock (if any) is held only during get_frame_span_impl(); it is released before FrameView is returned. Callers must not access the view concurrently with container writes.
See also
NDDataContainer::get_frame(), DataSpanVariant, DataVariantElement

Definition at line 621 of file NDData.hpp.


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