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"
29template <
typename ValueType,
typename SizeType,
size_t kCapacity>
30class BasicInlineAsyncQueue;
36template <
typename ValueType,
37 size_t kCapacity = containers::internal::kGenericSized>
40template <
typename ValueType,
42 size_t kCapacity = containers::internal::kGenericSized>
46 containers::internal::kGenericSized> {
50 containers::internal::kGenericSized>;
54 using typename Base::const_iterator;
55 using typename Base::const_pointer;
56 using typename Base::const_reference;
57 using typename Base::difference_type;
58 using typename Base::iterator;
59 using typename Base::pointer;
60 using typename Base::reference;
61 using typename Base::size_type;
62 using typename Base::value_type;
69 : deque_(count, value) {}
74 typename InputIterator,
75 typename = containers::internal::EnableIfInputIterator<InputIterator>>
77 : deque_(start, finish) {}
88 template <
size_t kOtherCapacity>
96 : deque_(std::move(other.deque_)) {}
101 template <
size_t kOtherCapacity>
104 *
this = std::move(other);
108 const std::initializer_list<value_type>& list) {
109 deque_ = std::move(list);
115 deque_ = other.deque_;
122 template <
size_t kOtherCapacity>
125 deque_ = other.deque_;
131 deque_ = std::move(other.deque_);
138 template <
size_t kOtherCapacity>
141 deque_ = std::move(other.deque_);
145 template <
typename OtherValueType,
146 typename = containers::internal::EnableIfIterable<OtherValueType>>
148 deque_ = Deque(other.begin(), other.end());
154 static constexpr size_type max_size() {
return capacity(); }
155 static constexpr size_type capacity() {
return kCapacity; }
158 friend class BasicInlineAsyncQueue<ValueType,
160 containers::internal::kGenericSized>;
173template <typename ValueType, typename SizeType>
176 containers::internal::kGenericSized>
178 BasicInlineAsyncQueue<ValueType, SizeType>,
179 BasicInlineAsyncDeque<ValueType, SizeType>> {
182 using Base = containers::internal::
183 BasicInlineQueueImpl<BasicInlineAsyncQueue<ValueType, SizeType>,
Deque>;
186 using typename Base::const_iterator;
187 using typename Base::const_pointer;
188 using typename Base::const_reference;
189 using typename Base::difference_type;
190 using typename Base::iterator;
191 using typename Base::pointer;
192 using typename Base::reference;
193 using typename Base::size_type;
194 using typename Base::value_type;
198 return deque().PendHasSpace(context, num);
203 return deque().PendNotEmpty(context);
210 template <
typename,
typename>
211 friend class containers::internal::GenericQueue;
213 template <
size_t kCapacity>
216 Deque& deque() {
return static_cast<Derived<0>*
>(
this)->deque_; }
217 const Deque& deque()
const {
218 return static_cast<const Derived<0>*
>(
this)->deque_;
Definition: inline_async_deque.h:49
Definition: inline_async_queue.h:179
async2::Poll PendHasSpace(async2::Context &context, size_type num=1)
Returns Pending until space for num elements is available.
Definition: inline_async_queue.h:197
async2::Poll PendNotEmpty(async2::Context &context)
Returns Pending until an element is available.
Definition: inline_async_queue.h:202
Definition: inline_async_queue.h:46
BasicInlineAsyncQueue(const BasicInlineAsyncQueue &other)
Copy constructs for matching capacity.
Definition: inline_async_queue.h:83
BasicInlineAsyncQueue(BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_async_queue.h:102
BasicInlineAsyncQueue & operator=(BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_async_queue.h:139
BasicInlineAsyncQueue & operator=(BasicInlineAsyncQueue &&other)
Move assigns from matching capacity.
Definition: inline_async_queue.h:130
BasicInlineAsyncQueue(const BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_async_queue.h:89
BasicInlineAsyncQueue & operator=(const BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_async_queue.h:123
BasicInlineAsyncQueue(BasicInlineAsyncQueue &&other)
Move constructs for matching capacity.
Definition: inline_async_queue.h:95
BasicInlineAsyncQueue & operator=(const BasicInlineAsyncQueue &other)
Copy assigns from matching capacity.
Definition: inline_async_queue.h:114
Definition: inline_queue.h:244
Provides basic helpers for reading and writing UTF-8 encoded strings.
Definition: alignment.h:27