44#include " infra/event/EventDispatcher.hpp"
55#include " infra/stream/InputStream.hpp"
66#include " infra/util/Function.hpp"
7+ #include " infra/util/ReallyAssert.hpp"
78#include " infra/util/WithStorage.hpp"
89#include < array>
910#include < atomic>
@@ -26,7 +27,9 @@ namespace infra
2627 QueueForOneReaderOneIrqWriter (infra::MemoryRange<T> buffer, const infra::Function<void ()>& onDataAvailable);
2728
2829 void AddFromInterrupt (T element);
30+ void AddFromInterruptUnchecked (T element);
2931 void AddFromInterrupt (infra::MemoryRange<const T> data);
32+ void AddFromInterruptUnchecked (infra::MemoryRange<const T> data);
3033
3134 bool Empty () const ;
3235 bool Full () const ;
@@ -89,7 +92,13 @@ namespace infra
8992 template <class T >
9093 void QueueForOneReaderOneIrqWriter<T>::AddFromInterrupt(T element)
9194 {
92- assert (!Full ());
95+ really_assert (!Full ());
96+ AddFromInterruptUnchecked (element);
97+ }
98+
99+ template <class T >
100+ void QueueForOneReaderOneIrqWriter<T>::AddFromInterruptUnchecked(T element)
101+ {
93102 *contentsEnd = element;
94103
95104 if (contentsEnd == buffer.end () - 1 )
@@ -102,6 +111,13 @@ namespace infra
102111
103112 template <class T >
104113 void QueueForOneReaderOneIrqWriter<T>::AddFromInterrupt(infra::MemoryRange<const T> data)
114+ {
115+ really_assert (!Full ());
116+ AddFromInterruptUnchecked (data);
117+ }
118+
119+ template <class T >
120+ void QueueForOneReaderOneIrqWriter<T>::AddFromInterruptUnchecked(infra::MemoryRange<const T> data)
105121 {
106122 std::size_t copySize = std::min<std::size_t >(data.size (), buffer.end () - contentsEnd);
107123 T* begin = contentsBegin.load ();
0 commit comments