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

◆ push_singlethread()

template<typename T , typename StoragePolicy , typename ConcurrencyPolicy = SingleThreadedPolicy, typename AccessPattern = QueueAccess>
bool MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::push_singlethread ( const T &  value)
inlineprivatenoexcept

Definition at line 1061 of file RingBuffer.hpp.

1062 {
1063 const size_t cap = m_storage.capacity();
1064 auto next_write = State::increment(m_state.write_index, cap);
1065
1066 if (next_write == m_state.read_index) {
1067 return false;
1068 }
1069
1070 if constexpr (AccessPattern::push_front) {
1071 m_state.write_index = (m_state.write_index == 0)
1072 ? cap - 1
1073 : m_state.write_index - 1;
1074 m_storage.buffer[m_state.write_index] = value;
1075 } else {
1076 m_storage.buffer[m_state.write_index] = value;
1077 m_state.write_index = next_write;
1078 }
1079
1080 return true;
1081 }

References MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::m_state, and MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::m_storage.

Referenced by MayaFlux::Memory::RingBuffer< T, StoragePolicy, ConcurrencyPolicy, AccessPattern >::push().

+ Here is the caller graph for this function: