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

◆ add_child_buffer()

template<typename BufferType >
virtual void MayaFlux::Buffers::RootBuffer< BufferType >::add_child_buffer ( std::shared_ptr< BufferType >  buffer)
inlinevirtual

Adds a tributary buffer to this root buffer.

Parameters
bufferChild buffer to add to the aggregation hierarchy

Tributary buffers contribute their data to the root buffer when the root buffer is processed. This allows multiple computational streams to be combined into a single output channel.

Exceptions
std::runtime_errorif buffer is not acceptable based on current token enforcement strategy

Definition at line 22 of file RootBuffer.hpp.

23 {
24 if (this->is_processing()) {
25 for (auto& m_pending_op : m_pending_ops) {
26 bool expected = false;
27 if (m_pending_op.active.compare_exchange_strong(expected, true, std::memory_order_acquire, std::memory_order_relaxed)) {
28 m_pending_op.buffer = buffer;
29 m_pending_op.is_addition = true;
30 m_pending_count.fetch_add(1, std::memory_order_relaxed);
31 return;
32 }
33 }
34
35 return;
36 }
38 }
struct MayaFlux::Buffers::RootBuffer::PendingBufferOp m_pending_ops[MAX_PENDING]
void add_child_buffer_direct(std::shared_ptr< BufferType > buffer)
std::atomic< uint32_t > m_pending_count