8 #include <density/detail/function_runtime_type.h> 9 #include <density/heter_queue.h> 36 #ifndef DOXYGEN_DOC_GENERATION 40 typename ALLOCATOR_TYPE,
53 heter_queue<detail::FunctionRuntimeType<ERASURE, RET_VAL(PARAMS...)>, ALLOCATOR_TYPE>;
91 swap(i_first.m_queue, i_second.m_queue);
97 auto erasure = ERASURE;
105 template <
typename ELEMENT_COMPLETE_TYPE>
110 template <
typename ELEMENT_COMPLETE_TYPE>
127 template <
typename ELEMENT_COMPLETE_TYPE>
void push(ELEMENT_COMPLETE_TYPE && i_source)
129 m_queue.
push(std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
139 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
140 void emplace(CONSTRUCTION_PARAMS &&... i_construction_params)
142 m_queue.template emplace<ELEMENT_COMPLETE_TYPE>(
143 std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
153 template <
typename ELEMENT_TYPE>
157 return m_queue.
start_push(std::forward<ELEMENT_TYPE>(i_source));
168 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
171 return m_queue.template start_emplace<ELEMENT_TYPE>(
172 std::forward<ELEMENT_TYPE>(i_construction_params)...);
180 template <
typename ELEMENT_COMPLETE_TYPE>
183 m_queue.
reentrant_push(std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
193 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
196 m_queue.template reentrant_emplace<ELEMENT_COMPLETE_TYPE>(
197 std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
207 template <
typename ELEMENT_TYPE>
222 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
226 return m_queue.template start_reentrant_emplace<ELEMENT_TYPE>(
227 std::forward<ELEMENT_TYPE>(i_construction_params)...);
245 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
248 return try_consume_impl(std::is_void<RET_VAL>(), std::forward<PARAMS>(i_params)...);
271 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
274 return try_consume_impl_cached(
275 std::is_void<RET_VAL>(), i_consume, std::forward<PARAMS>(i_params)...);
292 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
295 return try_reentrant_consume_impl(
296 std::is_void<RET_VAL>(), std::forward<PARAMS>(i_params)...);
318 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
321 return try_reentrant_consume_impl_cached(
322 std::is_void<RET_VAL>(), i_consume, std::forward<PARAMS>(i_params)...);
334 typename std::enable_if<ERASURE_ != function_manual_clear>::type * =
nullptr>
337 auto erasure = ERASURE;
357 auto && result = cons.complete_type().align_invoke_destroy(
358 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
359 cons.commit_nodestroy();
369 bool try_consume_impl(std::true_type, PARAMS... i_params)
373 cons.complete_type().align_invoke_destroy(
374 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
375 cons.commit_nodestroy();
390 auto && result = i_consume.complete_type().align_invoke_destroy(
391 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
392 i_consume.commit_nodestroy();
403 try_consume_impl_cached(std::true_type,
consume_operation & i_consume, PARAMS... i_params)
407 i_consume.complete_type().align_invoke_destroy(
408 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
409 i_consume.commit_nodestroy();
419 optional<RET_VAL> try_reentrant_consume_impl(std::false_type, PARAMS... i_params)
423 auto && result = cons.complete_type().align_invoke_destroy(
424 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
425 cons.commit_nodestroy();
435 bool try_reentrant_consume_impl(std::true_type, PARAMS... i_params)
439 cons.complete_type().align_invoke_destroy(
440 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
441 cons.commit_nodestroy();
456 auto && result = i_consume.complete_type().align_invoke_destroy(
457 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
458 i_consume.commit_nodestroy();
468 bool try_reentrant_consume_impl_cached(
473 i_consume.complete_type().align_invoke_destroy(
474 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
475 i_consume.commit_nodestroy();
bool empty() const noexcept
Definition: heter_queue.h:458
basic_default_allocator< default_page_capacity > default_allocator
Definition: default_allocator.h:152
Definition: conc_function_queue.h:11
void push(ELEMENT_COMPLETE_TYPE &&i_source)
Definition: function_queue.h:127
void emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: function_queue.h:140
static constexpr bool concurrent_consumes
Definition: function_queue.h:61
reentrant_put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_reentrant_push(ELEMENT_TYPE &&i_source)
Definition: function_queue.h:209
std::conditional< std::is_void< RET_VAL >::value, bool, optional< RET_VAL > >::type try_reentrant_consume(reentrant_consume_operation &i_consume, PARAMS...i_params)
Definition: function_queue.h:319
typename UnderlyingQueue::consume_operation consume_operation
Definition: function_queue.h:115
put_transaction< ELEMENT_TYPE > start_emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: function_queue.h:169
void push(ELEMENT_TYPE &&i_source)
Definition: heter_queue.h:1089
typename UnderlyingQueue::template put_transaction< ELEMENT_COMPLETE_TYPE > put_transaction
Definition: function_queue.h:107
#define DENSITY_ASSERT(...)
Definition: density_config.h:19
reentrant_consume_operation try_start_reentrant_consume() noexcept
Definition: heter_queue.h:2322
reentrant_put_transaction< ELEMENT_TYPE > start_reentrant_emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: function_queue.h:224
put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_push(ELEMENT_TYPE &&i_source)
Definition: heter_queue.h:1208
void reentrant_push(ELEMENT_COMPLETE_TYPE &&i_source)
Definition: function_queue.h:181
Definition: density_common.h:99
std::conditional< std::is_void< RET_VAL >::value, bool, optional< RET_VAL > >::type try_consume(PARAMS...i_params)
Definition: function_queue.h:246
void clear() noexcept
Definition: heter_queue.h:480
Definition: density_common.h:101
constexpr function_queue() noexcept=default
typename UnderlyingQueue::reentrant_consume_operation reentrant_consume_operation
Definition: function_queue.h:118
std::conditional< std::is_void< RET_VAL >::value, bool, optional< RET_VAL > >::type try_consume(consume_operation &i_consume, PARAMS...i_params)
Definition: function_queue.h:272
bool empty() noexcept
Definition: function_queue.h:349
builtin_optional< TYPE > optional
Definition: density_config.h:218
put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_push(ELEMENT_TYPE &&i_source)
Definition: function_queue.h:155
friend void swap(function_queue &i_first, function_queue &i_second) noexcept
Definition: function_queue.h:88
static constexpr bool concurrent_puts
Definition: function_queue.h:58
consume_operation try_start_consume() noexcept
Definition: heter_queue.h:1456
~function_queue()
Definition: function_queue.h:95
static constexpr bool concurrent_put_consumes
Definition: function_queue.h:65
std::conditional< std::is_void< RET_VAL >::value, bool, optional< RET_VAL > >::type try_reentrant_consume(PARAMS...i_params)
Definition: function_queue.h:293
void reentrant_emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: function_queue.h:194
typename UnderlyingQueue::template reentrant_put_transaction< ELEMENT_COMPLETE_TYPE > reentrant_put_transaction
Definition: function_queue.h:112
void reentrant_push(ELEMENT_TYPE &&i_source)
Definition: heter_queue.h:2068
Definition: function_queue.h:17
function_type_erasure
Definition: density_common.h:97
reentrant_put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_reentrant_push(ELEMENT_TYPE &&i_source)
Definition: heter_queue.h:2124
#define DENSITY_ASSUME(bool_expr,...)
Definition: density_config.h:46
void clear() noexcept
Definition: function_queue.h:335
static constexpr bool is_seq_cst
Definition: function_queue.h:68