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

SignalSourceContainer wrapping a live GLFW/Vulkan window surface. More...

#include <WindowContainer.hpp>

+ Inheritance diagram for MayaFlux::Kakshya::WindowContainer:
+ Collaboration diagram for MayaFlux::Kakshya::WindowContainer:

Public Member Functions

 WindowContainer (std::shared_ptr< Core::Window > window)
 Construct from an existing managed window.
 
 ~WindowContainer () override=default
 
 WindowContainer (const WindowContainer &)=delete
 
WindowContaineroperator= (const WindowContainer &)=delete
 
 WindowContainer (WindowContainer &&)=delete
 
WindowContaineroperator= (WindowContainer &&)=delete
 
std::shared_ptr< Core::Windowget_window () const
 The underlying window.
 
std::vector< DataDimensionget_dimensions () const override
 Get the dimensions describing the structure of the data.
 
uint64_t get_total_elements () const override
 Get the total number of elements in the container.
 
MemoryLayout get_memory_layout () const override
 Get the memory layout used by this container.
 
void set_memory_layout (MemoryLayout layout) override
 Set the memory layout for this container.
 
std::vector< DataVariantget_region_data (const Region &region) const override
 Extract data for all regions across all region groups that spatially intersect region.
 
void set_region_data (const Region &region, const std::vector< DataVariant > &data) override
 Set data for a specific region.
 
std::vector< DataVariantget_region_group_data (const RegionGroup &group) const override
 Get data for multiple regions efficiently.
 
std::vector< DataVariantget_segments_data (const std::vector< RegionSegment > &segments) const override
 Get data for multiple region segments efficiently.
 
double get_value_at (const std::vector< uint64_t > &coordinates) const override
 Get a single value at the specified coordinates.
 
void set_value_at (const std::vector< uint64_t > &coordinates, double value) override
 Set a single value at the specified coordinates.
 
uint64_t coordinates_to_linear_index (const std::vector< uint64_t > &coordinates) const override
 Convert coordinates to linear index based on current memory layout.
 
std::vector< uint64_t > linear_index_to_coordinates (uint64_t linear_index) const override
 Convert linear index to coordinates based on current memory layout.
 
void clear () override
 Clear all data in the container.
 
void lock () override
 Acquire a lock for thread-safe access.
 
void unlock () override
 Release a previously acquired lock.
 
bool try_lock () override
 Attempt to acquire a lock without blocking.
 
const void * get_raw_data () const override
 Get a raw pointer to the underlying data storage.
 
bool has_data () const override
 Check if the container currently holds any data.
 
ContainerDataStructureget_structure () override
 Get the data structure defining this container's layout.
 
const ContainerDataStructureget_structure () const override
 
void set_structure (ContainerDataStructure s) override
 Set the data structure for this container.
 
void add_region_group (const RegionGroup &group) override
 Add a named group of regions to the container.
 
const RegionGroupget_region_group (const std::string &name) const override
 Get a region group by name.
 
std::unordered_map< std::string, RegionGroupget_all_region_groups () const override
 Get all region groups in the container.
 
void remove_region_group (const std::string &name) override
 Remove a region group by name.
 
void load_region (const Region &region) override
 No-op.
 
void unload_region (const Region &region) override
 No-op.
 
bool is_region_loaded (const Region &region) const override
 Always returns true.
 
ProcessingState get_processing_state () const override
 Get the current processing state of the container.
 
void update_processing_state (ProcessingState new_state) override
 Update the processing state of the container.
 
void register_state_change_callback (std::function< void(const std::shared_ptr< SignalSourceContainer > &, ProcessingState)> callback) override
 Register a callback to be invoked on processing state changes.
 
void unregister_state_change_callback () override
 Unregister the state change callback, if any.
 
bool is_ready_for_processing () const override
 Check if the container is ready for processing.
 
void mark_ready_for_processing (bool ready) override
 Mark the container as ready or not ready for processing.
 
void create_default_processor () override
 Create and configure a default processor for this container.
 
void process_default () override
 Process the container's data using the default processor.
 
void set_default_processor (const std::shared_ptr< DataProcessor > &processor) override
 Set the default data processor for this container.
 
std::shared_ptr< DataProcessorget_default_processor () const override
 Get the current default data processor.
 
std::shared_ptr< DataProcessingChainget_processing_chain () override
 Get the current processing chain for this container.
 
void set_processing_chain (const std::shared_ptr< DataProcessingChain > &chain) override
 Set the processing chain for this container.
 
uint32_t register_dimension_reader (uint32_t dimension_index) override
 Register a reader for a specific dimension.
 
void unregister_dimension_reader (uint32_t dimension_index) override
 Unregister a reader for a specific dimension.
 
bool has_active_readers () const override
 Check if any dimensions currently have active readers.
 
void mark_dimension_consumed (uint32_t dimension_index, uint32_t reader_id) override
 Mark a dimension as consumed for the current processing cycle.
 
bool all_dimensions_consumed () const override
 Check if all active dimensions have been consumed in this cycle.
 
std::vector< DataVariant > & get_processed_data () override
 Get a mutable reference to the processed data buffer.
 
const std::vector< DataVariant > & get_processed_data () const override
 Get a const reference to the processed data buffer.
 
const std::vector< DataVariant > & get_data () override
 Get a reference to the raw data stored in the container.
 
void mark_buffers_for_processing (bool) override
 Mark associated buffers for processing in the next cycle.
 
void mark_buffers_for_removal () override
 Mark associated buffers for removal from the system.
 
DataAccess channel_data (size_t channel_index) override
 Get channel data with semantic interpretation.
 
std::vector< DataAccessall_channel_data () override
 Get all channel data as accessors.
 
- Public Member Functions inherited from MayaFlux::Kakshya::SignalSourceContainer
 ~SignalSourceContainer () override=default
 
- Public Member Functions inherited from MayaFlux::Kakshya::NDDataContainer
virtual ~NDDataContainer ()=default
 
virtual uint64_t get_frame_size () const =0
 Get the number of elements that constitute one "frame".
 
virtual uint64_t get_num_frames () const =0
 Get the number of frames in the primary (temporal) dimension.
 
virtual std::span< const double > get_frame (uint64_t frame_index) const =0
 Get a single frame of data efficiently.
 
virtual void get_frames (std::span< double > output, uint64_t start_frame, uint64_t num_frames) const =0
 Get multiple frames efficiently.
 

Private Member Functions

void setup_dimensions ()
 

Private Attributes

std::shared_ptr< Core::Windowm_window
 
ContainerDataStructure m_structure
 
std::vector< DataVariantm_data
 
std::vector< DataVariantm_processed_data
 
std::unordered_map< std::string, RegionGroupm_region_groups
 
std::shared_ptr< DataProcessorm_default_processor
 
std::shared_ptr< DataProcessingChainm_processing_chain
 
std::atomic< ProcessingStatem_processing_state { ProcessingState::IDLE }
 
std::atomic< bool > m_ready_for_processing { false }
 
std::function< void(const std::shared_ptr< SignalSourceContainer > &, ProcessingState)> m_state_callback
 
std::shared_mutex m_data_mutex
 
std::mutex m_state_mutex
 
std::atomic< uint32_t > m_registered_readers { 0 }
 
std::atomic< uint32_t > m_consumed_readers { 0 }
 
std::atomic< uint32_t > m_next_reader_id { 0 }
 

Detailed Description

SignalSourceContainer wrapping a live GLFW/Vulkan window surface.

Exposes a window's rendered surface as addressable N-dimensional data. Dimensions follow IMAGE_COLOR convention: dims[0] → SPATIAL_Y (height) dims[1] → SPATIAL_X (width) dims[2] → CHANNEL

Region semantics: Regions are registered through the inherited RegionGroup API (add_region_group / get_all_region_groups / remove_region_group). load_region() and unload_region() are no-ops on this container — all surface data is always available after a GPU readback; region selection is a processor concern, not a container concern.

Processing model:

  • The default processor (WindowAccessProcessor) performs one full-surface GPU readback per process() call into processed_data[0].
  • The processing chain (SpatialRegionProcessor) extracts registered regions from the readback as separate DataVariant entries.
  • get_region_data() crops directly from processed_data[0] if it is non-empty; returns empty if no readback has occurred yet.
  • The container never calls process() itself — callers drive the chain.

Write semantics (compositing) are deferred to a future processor.

Definition at line 39 of file WindowContainer.hpp.


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