MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ read_cross_subsystem_buffer()

std::optional< std::span< const double > > MayaFlux::Core::SubsystemManager::read_cross_subsystem_buffer ( SubsystemType  requesting_type,
SubsystemType  target_type,
uint32_t  channel 
)

Read data from another subsystem's buffers.

Parameters
requesting_typeSubsystemType making the data request
target_typeSubsystemType providing the data
channelChannel index to read from
Returns
Read-only span if access allowed, nullopt otherwise

Enables controlled cross-subsystem data sharing with permission checking. Used for scenarios where one subsystem needs processed data from another.

Definition at line 193 of file SubsystemManager.cpp.

197{
198 std::shared_lock lock(m_mutex);
199
200 if (m_subsystems.find(requesting_type) == m_subsystems.end()) {
201 return std::nullopt;
202 }
203
204 if (!is_cross_access_allowed(requesting_type, target_type)) {
205 return std::nullopt;
206 }
207
208 auto target_token = m_subsystems[target_type]->get_tokens();
209
210 try {
211 return m_buffer_manager->get_buffer_data(target_token.Buffer, channel);
212 } catch (...) {
213 return std::nullopt;
214 }
215}
std::shared_ptr< Buffers::BufferManager > m_buffer_manager
bool is_cross_access_allowed(SubsystemType from, SubsystemType to) const
std::unordered_map< SubsystemType, std::shared_ptr< ISubsystem > > m_subsystems
std::shared_mutex m_mutex
Thread safety for subsystem operations.

References is_cross_access_allowed(), m_buffer_manager, m_mutex, and m_subsystems.

+ Here is the call graph for this function: