19#include "pw_async2/context.h"
20#include "pw_async2/poll.h"
21#include "pw_async2/try.h"
22#include "pw_containers/inline_async_deque.h"
23#include "pw_containers/inline_queue.h"
24#include "pw_containers/internal/async_count_and_capacity.h"
31template <
typename ValueType,
typename SizeType,
size_t kCapacity>
32class BasicInlineAsyncQueue;
41template <
typename ValueType,
42 size_t kCapacity = containers::internal::kGenericSized>
56template <
typename ValueType,
58 size_t kCapacity = containers::internal::kGenericSized>
62 containers::internal::kGenericSized> {
66 containers::internal::kGenericSized>;
70 using typename Base::const_iterator;
71 using typename Base::const_pointer;
72 using typename Base::const_reference;
73 using typename Base::difference_type;
74 using typename Base::iterator;
75 using typename Base::pointer;
76 using typename Base::reference;
77 using typename Base::size_type;
78 using typename Base::value_type;
85 : deque_(count, value) {}
90 typename InputIterator,
91 typename = containers::internal::EnableIfInputIterator<InputIterator>>
93 : deque_(start, finish) {}
104 template <
size_t kOtherCapacity>
112 : deque_(std::move(other.deque_)) {}
117 template <
size_t kOtherCapacity>
120 *
this = std::move(other);
124 const std::initializer_list<value_type>& list) {
125 deque_ = std::move(list);
131 deque_ = other.deque_;
138 template <
size_t kOtherCapacity>
141 deque_ = other.deque_;
147 deque_ = std::move(other.deque_);
154 template <
size_t kOtherCapacity>
157 deque_ = std::move(other.deque_);
161 template <
typename OtherValueType,
162 typename = containers::internal::EnableIfIterable<OtherValueType>>
164 deque_ = Deque(other.begin(), other.end());
170 static constexpr size_type max_size() {
return capacity(); }
171 static constexpr size_type capacity() {
return kCapacity; }
178 using Base::PendHasSpace;
181 using Base::PendNotEmpty;
184 friend class BasicInlineAsyncQueue<ValueType,
186 containers::internal::kGenericSized>;
201template <typename ValueType, typename SizeType>
204 containers::internal::kGenericSized>
206 BasicInlineAsyncQueue<ValueType, SizeType>,
207 BasicInlineAsyncDeque<ValueType, SizeType>> {
210 using Base = containers::internal::
211 BasicInlineQueueImpl<BasicInlineAsyncQueue<ValueType, SizeType>,
Deque>;
214 using typename Base::const_iterator;
215 using typename Base::const_pointer;
216 using typename Base::const_reference;
217 using typename Base::difference_type;
218 using typename Base::iterator;
219 using typename Base::pointer;
220 using typename Base::reference;
221 using typename Base::size_type;
222 using typename Base::value_type;
225 return deque().PendHasSpace(context, num);
229 return deque().PendNotEmpty(context);
236 template <
typename,
typename>
237 friend class containers::internal::GenericQueue;
239 template <
size_t kCapacity>
242 Deque& deque() {
return static_cast<Derived<0>*
>(
this)->deque_; }
243 const Deque& deque()
const {
244 return static_cast<const Derived<0>*
>(
this)->deque_;
Definition: inline_async_deque.h:65
Definition: inline_async_queue.h:207
Definition: inline_async_queue.h:62
BasicInlineAsyncQueue(const BasicInlineAsyncQueue &other)
Copy constructs for matching capacity.
Definition: inline_async_queue.h:99
BasicInlineAsyncQueue(BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_async_queue.h:118
BasicInlineAsyncQueue & operator=(BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_async_queue.h:155
BasicInlineAsyncQueue & operator=(BasicInlineAsyncQueue &&other)
Move assigns from matching capacity.
Definition: inline_async_queue.h:146
BasicInlineAsyncQueue(const BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_async_queue.h:105
async2::Poll PendHasSpace(async2::Context &context, size_type num=1)
Returns pw::async2::Pending until space for num elements is available.
Definition: inline_async_queue.h:224
BasicInlineAsyncQueue & operator=(const BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_async_queue.h:139
BasicInlineAsyncQueue(BasicInlineAsyncQueue &&other)
Move constructs for matching capacity.
Definition: inline_async_queue.h:111
async2::Poll PendNotEmpty(async2::Context &context)
Returns pw::async2::Pending until an element is available.
Definition: inline_async_queue.h:228
BasicInlineAsyncQueue & operator=(const BasicInlineAsyncQueue &other)
Copy assigns from matching capacity.
Definition: inline_async_queue.h:130
Definition: inline_queue.h:251
The Pigweed namespace.
Definition: alignment.h:27