MayaFlux 0.3.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 232 of file SubsystemManager.cpp.

236{
237 std::shared_lock lock(m_mutex);
238
239 if (m_subsystems.find(requesting_type) == m_subsystems.end()) {
240 return std::nullopt;
241 }
242
243 if (!is_cross_access_allowed(requesting_type, target_type)) {
244 return std::nullopt;
245 }
246
247 auto target_token = m_subsystems[target_type]->get_tokens();
248
249 try {
250 return m_buffer_manager->get_buffer_data(target_token.Buffer, channel);
251 } catch (...) {
252 return std::nullopt;
253 }
254}
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: