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 247 of file SubsystemManager.cpp.

251{
252 std::shared_lock lock(m_mutex);
253
254 if (m_subsystems.find(requesting_type) == m_subsystems.end()) {
255 return std::nullopt;
256 }
257
258 if (!is_cross_access_allowed(requesting_type, target_type)) {
259 return std::nullopt;
260 }
261
262 auto target_token = m_subsystems[target_type]->get_tokens();
263
264 try {
265 return m_buffer_manager->get_buffer_data(target_token.Buffer, channel);
266 } catch (...) {
267 return std::nullopt;
268 }
269}
uint32_t channel
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 channel, is_cross_access_allowed(), m_buffer_manager, m_mutex, and m_subsystems.

+ Here is the call graph for this function: