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"
25#include "pw_preprocessor/compiler.h"
35template <
typename ValueType,
typename SizeType,
size_t kCapacity>
36class BasicInlineAsyncQueue;
48template <
typename ValueType,
49 size_t kCapacity = containers::internal::kGenericSized>
68template <
typename ValueType,
70 size_t kCapacity = containers::internal::kGenericSized>
71class [[deprecated(
"Use pw_async2 Channels instead (pw_async2/channel.h)")]]
75 containers::internal::kGenericSized> {
79 containers::internal::kGenericSized>;
83 using typename Base::const_iterator;
84 using typename Base::const_pointer;
85 using typename Base::const_reference;
86 using typename Base::difference_type;
87 using typename Base::iterator;
88 using typename Base::pointer;
89 using typename Base::reference;
90 using typename Base::size_type;
91 using typename Base::value_type;
98 : deque_(count, value) {}
103 typename InputIterator,
104 typename = containers::internal::EnableIfInputIterator<InputIterator>>
106 : deque_(start, finish) {}
117 template <
size_t kOtherCapacity>
125 : deque_(std::move(other.deque_)) {}
130 template <
size_t kOtherCapacity>
133 *
this = std::move(other);
137 const std::initializer_list<value_type>& list) {
138 deque_ = std::move(list);
144 deque_ = other.deque_;
151 template <
size_t kOtherCapacity>
154 deque_ = other.deque_;
160 deque_ = std::move(other.deque_);
167 template <
size_t kOtherCapacity>
170 deque_ = std::move(other.deque_);
174 template <
typename OtherValueType,
175 typename = containers::internal::EnableIfIterable<OtherValueType>>
177 deque_ =
Deque(other.begin(), other.end());
183 static constexpr size_type max_size() {
return capacity(); }
184 static constexpr size_type capacity() {
return kCapacity; }
191 using Base::PendHasSpace;
194 using Base::PendNotEmpty;
212template <
typename ValueType,
typename SizeType>
215 containers::internal::kGenericSized>
217 BasicInlineAsyncQueue<ValueType, SizeType>,
218 BasicInlineAsyncDeque<ValueType, SizeType>> {
221 using Base = containers::internal::
222 BasicInlineQueueImpl<BasicInlineAsyncQueue<ValueType, SizeType>,
Deque>;
225 using typename Base::const_iterator;
226 using typename Base::const_pointer;
227 using typename Base::const_reference;
228 using typename Base::difference_type;
229 using typename Base::iterator;
230 using typename Base::pointer;
231 using typename Base::reference;
232 using typename Base::size_type;
233 using typename Base::value_type;
236 return deque().PendHasSpace(context, num);
240 return deque().PendNotEmpty(context);
247 template <
typename,
typename>
250 template <
size_t kCapacity>
253 Deque& deque() {
return static_cast<Derived<0>*
>(
this)->deque_; }
254 const Deque& deque()
const {
255 return static_cast<const Derived<0>*
>(
this)->deque_;
Definition: inline_async_deque.h:79
Definition: inline_async_queue.h:218
Definition: inline_async_queue.h:75
BasicInlineAsyncQueue(const BasicInlineAsyncQueue &other)
Copy constructs for matching capacity.
Definition: inline_async_queue.h:112
BasicInlineAsyncQueue(BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_async_queue.h:131
BasicInlineAsyncQueue & operator=(BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_async_queue.h:168
BasicInlineAsyncQueue & operator=(BasicInlineAsyncQueue &&other)
Move assigns from matching capacity.
Definition: inline_async_queue.h:159
BasicInlineAsyncQueue(const BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_async_queue.h:118
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:235
BasicInlineAsyncQueue & operator=(const BasicInlineAsyncQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_async_queue.h:152
BasicInlineAsyncQueue(BasicInlineAsyncQueue &&other)
Move constructs for matching capacity.
Definition: inline_async_queue.h:124
async2::Poll PendNotEmpty(async2::Context &context)
Returns pw::async2::Pending until an element is available.
Definition: inline_async_queue.h:239
BasicInlineAsyncQueue & operator=(const BasicInlineAsyncQueue &other)
Copy assigns from matching capacity.
Definition: inline_async_queue.h:143
Definition: inline_queue.h:251
Definition: generic_queue.h:25
#define PW_MODIFY_DIAGNOSTICS_POP()
Definition: compiler.h:194
#define PW_MODIFY_DIAGNOSTIC(kind, option)
Definition: compiler.h:203
#define PW_MODIFY_DIAGNOSTICS_PUSH()
Definition: compiler.h:189
The Pigweed namespace.
Definition: alignment.h:27