density
C++11 library for paged memory management, function queues, heterogeneous queues and lifo memory management
|
#include <sp_heter_queue.h>
Public Member Functions | |
consume_operation () noexcept=default | |
consume_operation (const consume_operation &)=delete | |
consume_operation & | operator= (const consume_operation &)=delete |
consume_operation (consume_operation &&i_source) noexcept=default | |
consume_operation & | operator= (consume_operation &&i_source) noexcept=default |
~consume_operation () | |
bool | empty () const noexcept |
operator bool () const noexcept | |
sp_heter_queue * | queue () const noexcept |
void | commit () noexcept |
void | commit_nodestroy () noexcept |
void | cancel () noexcept |
const RUNTIME_TYPE & | complete_type () const noexcept |
void * | unaligned_element_ptr () const noexcept |
void * | element_ptr () const noexcept |
template<typename COMPLETE_ELEMENT_TYPE > | |
COMPLETE_ELEMENT_TYPE & | element () const noexcept |
consume_operation (PrivateType, sp_heter_queue *i_queue) noexcept | |
bool | start_consume_impl (PrivateType, sp_heter_queue *i_queue) |
Friends | |
void | swap (consume_operation &i_first, consume_operation &i_second) noexcept |
Move-only class that can be bound to a consume operation, otherwise it's empty.
Consume functions on sp_heter_queue return a non-empty consume_operation that can be used to inspect or alter the element while it is not observable in the queue, and commit or cancel the consume.
A consume_operation is empty when:
Calling commit, commit_nodestroy, cancel, element_ptr, unaligned_element_ptr, element or complete_type on an empty consume_operation triggers undefined behavior.
|
defaultnoexcept |
Constructs an empty consume_operation
|
delete |
Copy construction is not allowed
|
defaultnoexcept |
Move constructor. The source is left in a valid but indeterminate state.
|
inline |
Destructor: cancel the operation (if any).
|
delete |
Copy assignment is not allowed
|
defaultnoexcept |
Move assignment. The source is left in a valid but indeterminate state.
|
inlinenoexcept |
Returns true whether this object does not hold the state of an operation.
|
inlineexplicitnoexcept |
Returns true whether this object does not hold the state of an operation. Same to !consume_operation::empty.
|
inlinenoexcept |
Returns a pointer to the target queue if a transaction is bound, otherwise returns nullptr
|
inlinenoexcept |
Destroys the element, making the consume irreversible. This comnsume_operation becomes empty.
Complexity: Constant.
Effects on iterators: no iterator is invalidated
Throws: Nothing.
|
inlinenoexcept |
Destroys the element, making the consume irreversible. This comnsume_operation becomes empty. The caller should destroy the element before calling this function. This object becomes empty.
Complexity: Constant.
Effects on iterators: no iterator is invalidated
Throws: Nothing.
Note: this function may be used to combine a feature of the runtime type on the element with the destruction of the element. For example a function queue may improve the performances using a feature like invoke_destroy to do both the function call and the destruction of the capture in a single call, making a single pseudo v-call instead of two.
|
inlinenoexcept |
Cancel the operation. This consume_operation becomes empty.
Complexity: Constant.
Effects on iterators: no iterator is invalidated
Throws: Nothing.
|
inlinenoexcept |
Returns the type of the element being consumed.
|
inlinenoexcept |
Returns a pointer that, if properly aligned to the alignment of the element type, points to the element. The returned address is guaranteed to be aligned to min_alignment
|
inlinenoexcept |
Returns a pointer to the element being consumed.
This call is equivalent to: address_upper_align(unaligned_element_ptr(), complete_type().alignment());
|
inlinenoexcept |
Returns a reference to the element being consumed.
|
friend |
Swaps two instances of consume_operation.