density
C++11 library for paged memory management, function queues, heterogeneous queues and lifo memory management
|
#include <conc_heter_queue.h>
Public Member Functions | |
put_transaction () noexcept=default | |
put_transaction (const put_transaction &)=delete | |
put_transaction & | operator= (const put_transaction &)=delete |
template<typename OTHERTYPE , typename = typename std::enable_if< std::is_same<OTHERTYPE, ELEMENT_COMPLETE_TYPE>::value || std::is_void<ELEMENT_COMPLETE_TYPE>::value>::type> | |
put_transaction (put_transaction< OTHERTYPE > &&i_source) noexcept | |
template<typename OTHERTYPE , typename = typename std::enable_if< std::is_same<OTHERTYPE, ELEMENT_COMPLETE_TYPE>::value || std::is_void<ELEMENT_COMPLETE_TYPE>::value>::type> | |
put_transaction & | operator= (put_transaction< OTHERTYPE > &&i_source) noexcept |
void * | raw_allocate (size_t i_size, size_t i_alignment) |
template<typename INPUT_ITERATOR > | |
std::iterator_traits< INPUT_ITERATOR >::value_type * | raw_allocate_copy (INPUT_ITERATOR i_begin, INPUT_ITERATOR i_end) |
template<typename INPUT_RANGE > | |
auto | raw_allocate_copy (const INPUT_RANGE &i_source_range) -> decltype(std::declval< put_transaction >().raw_allocate_copy( std::begin(i_source_range), std::end(i_source_range))) |
void | commit () noexcept |
void | cancel () noexcept |
bool | empty () const noexcept |
operator bool () const noexcept | |
void * | element_ptr () const noexcept |
ELEMENT_COMPLETE_TYPE & | element () const noexcept |
const RUNTIME_TYPE & | complete_type () const noexcept |
~put_transaction () | |
put_transaction (PrivateType, std::unique_lock< std::mutex > &&i_lock, typename InnerQueue::template put_transaction< ELEMENT_COMPLETE_TYPE > &&i_put_transaction) noexcept | |
Friends | |
template<typename OTHERTYPE > | |
class | put_transaction |
void | swap (put_transaction &i_first, put_transaction &i_second) noexcept |
Move-only class template that can be bound to a put transaction, otherwise it's empty.
ELEMENT_COMPLETE_TYPE | Complete type of elements that can be handled by a transaction, or void. ELEMENT_COMPLETE_TYPE must decay to itself (it can't be cv-qualified). |
Transactional put functions on conc_heter_queue return a non-empty put_transaction that can be used to allocate raw memory in the queue, inspect or alter the element while it is still not observable in the queue, and commit or cancel the push.
A put_transaction is empty when:
Calling raw_allocate, raw_allocate_copy, commit, cancel, element_ptr, element or complete_type on an empty put_transaction triggers undefined behavior.
A void put_transaction can be move constructed/assigned from any put_transaction. A typed put_transaction can be move constructed/assigned only from a put_transaction with the same ELEMENT_COMPLETE_TYPE.
|
defaultnoexcept |
Constructs an empty put transaction
|
delete |
Copy construction is not allowed.
|
inlinenoexcept |
Move constructs a put_transaction, transferring the state from the source.
i_source | source to move from. It becomes empty after the call. |
|
inline |
If this transaction is empty the destructor has no side effects. Otherwise it cancels it.
|
delete |
Copy assignment is not allowed.
|
inlinenoexcept |
Move assigns a put_transaction, transferring the state from the source.
i_source | source to move from. It becomes empty after the call. |
|
inline |
Allocates a memory block associated to the element being added in the queue. The block may be allocated contiguously with the elements in the memory pages. If the block does not fit in one page, the block is allocated using non-paged memory services of the allocator.
The block doesn't need to be deallocated, and is guaranteed to be valid until the associated element is destroyed. The initial content of the block is undefined.
i_size | size in bytes of the block to allocate. |
i_alignment | alignment of the block to allocate. It must be a non-zero power of 2, and less than or equal to i_size. |
Complexity: Unspecified.
Effects on iterators: no iterator is invalidated
Throws: unspecified.
Exception guarantee: strong (in case of exception the function has no observable effects).
|
inline |
Allocates a memory block associated to the element being added in the queue, and copies the content from a range of iterators. The block may be allocated contiguously with the elements in the memory pages. If the block does not fit in one page, the block is allocated using non-paged memory services of the allocator.
The block doesn't need to be deallocated, and is guaranteed to be valid until the associated element is destroyed. The initial content of the block is undefined.
i_begin | first element to be copied |
i_end | first element not to be copied |
Requires:
Complexity: Unspecified.
Effects on iterators: no iterator is invalidated
Throws: unspecified.
Exception guarantee: strong (in case of exception the function has no observable effects)
|
inline |
Allocates a memory block associated to the element being added in the queue, and copies the content from a range. The block may be allocated contiguously with the elements in the memory pages. If the block does not fit in one page, the block is allocated using non-paged memory services of the allocator.
The block doesn't need to be deallocated, and is guaranteed to be valid until the associated element is destroyed. The initial content of the block is undefined.
i_source_range | to be copied |
Requires:
Complexity: Unspecified.
Effects on iterators: no iterator is invalidated
Throws: unspecified.
Exception guarantee: strong (in case of exception the function has no observable effects).
|
inlinenoexcept |
Makes the effects of the transaction observable. This object becomes empty.
Complexity: Constant.
Effects on iterators: no iterator is invalidated
Throws: Nothing.
|
inlinenoexcept |
Cancel the transaction. This object becomes empty.
Complexity: Constant.
Effects on iterators: no iterator is invalidated
Throws: Nothing.
|
inlinenoexcept |
Returns true whether this object is not currently bound to a transaction.
|
inlineexplicitnoexcept |
Returns true whether this object is bound to a transaction. Same to !consume_operation::empty.
|
inlinenoexcept |
Returns a pointer to the object being added.
Notes:
|
inlinenoexcept |
Returns a reference to the element being added. This function can be used to modify the element before calling the commit.
Note: An element is observable in the queue only after commit has been called on the put_transaction. The element is constructed at the begin of the transaction, so the returned object is always valid.
Requires:
|
inlinenoexcept |
Returns the type of the object being added.
|
friend |
Swaps two instances of put_transaction.