MayaFlux 0.4.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 270 of file SubsystemManager.cpp.

274{
275 std::shared_lock lock(m_mutex);
276
277 if (m_subsystems.find(requesting_type) == m_subsystems.end()) {
278 return std::nullopt;
279 }
280
281 if (!is_cross_access_allowed(requesting_type, target_type)) {
282 return std::nullopt;
283 }
284
285 auto target_token = m_subsystems[target_type]->get_tokens();
286
287 try {
288 return m_buffer_manager->get_buffer_data(target_token.Buffer, channel);
289 } catch (...) {
290 return std::nullopt;
291 }
292}
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: