MayaFlux 1.0.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 = m_subsystems.find(target_type);
286 if (target == m_subsystems.end() || !target->second) {
287 return std::nullopt;
288 }
289
290 auto target_token = target->second->get_tokens();
291
292 try {
293 return m_buffer_manager->get_buffer_data(target_token.Buffer, channel);
294 } catch (...) {
295 return std::nullopt;
296 }
297}
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: