density
C++11 library for paged memory management, function queues, heterogeneous queues and lifo memory management
|
#include <sp_heter_queue.h>
Public Member Functions | |
reentrant_put_transaction () noexcept=default | |
reentrant_put_transaction (const reentrant_put_transaction &)=delete | |
reentrant_put_transaction & | operator= (const reentrant_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> | |
reentrant_put_transaction (reentrant_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> | |
reentrant_put_transaction & | operator= (reentrant_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< reentrant_put_transaction >().raw_allocate_copy( std::begin(i_source_range), std::end(i_source_range))) |
void * | try_raw_allocate (progress_guarantee i_progress_guarantee, size_t i_size, size_t i_alignment) noexcept |
template<typename INPUT_ITERATOR > | |
std::iterator_traits< INPUT_ITERATOR >::value_type * | try_raw_allocate_copy (progress_guarantee i_progress_guarantee, INPUT_ITERATOR i_begin, INPUT_ITERATOR i_end) noexcept(std:: is_nothrow_copy_constructible< typename std::iterator_traits< INPUT_ITERATOR >::value_type >::value) |
template<typename INPUT_RANGE > | |
auto | try_raw_allocate_copy (progress_guarantee i_progress_guarantee, const INPUT_RANGE &i_source_range) noexcept(noexcept(std::declval< reentrant_put_transaction >() .try_raw_allocate_copy( i_progress_guarantee, std::begin(i_source_range), std::end(i_source_range)))) -> decltype(std::declval< reentrant_put_transaction >().try_raw_allocate_copy( i_progress_guarantee, std::begin(i_source_range), std::end(i_source_range))) |
void | commit () noexcept |
void | cancel () noexcept |
bool | empty () const noexcept |
operator bool () const noexcept | |
sp_heter_queue * | queue () const noexcept |
void * | element_ptr () const noexcept |
ELEMENT_COMPLETE_TYPE & | element () const noexcept |
const RUNTIME_TYPE & | complete_type () const noexcept |
~reentrant_put_transaction () | |
reentrant_put_transaction (PrivateType, sp_heter_queue *i_queue, const Allocation &i_put) noexcept | |
Friends | |
template<typename OTHERTYPE > | |
class | reentrant_put_transaction |
void | swap (reentrant_put_transaction &i_first, reentrant_put_transaction &i_second) noexcept |
Move-only class template that can be bound to a reentrant 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). |
Reentrant transactional put functions on sp_heter_queue return a non-empty reentrant_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 reentrant_put_transaction is empty when:
Calling raw_allocate, raw_allocate_copy, commit, cancel, element_ptr, element or complete_type on an empty reentrant_put_transaction triggers undefined behavior.
A void reentrant_put_transaction can be move constructed/assigned from any reentrant_put_transaction. A typed reentrant_put_transaction can be move constructed/assigned only from a reentrant_put_transaction with the same ELEMENT_COMPLETE_TYPE.
|
defaultnoexcept |
Constructs an empty put transaction
|
delete |
Copy construction is not allowed.
|
inlinenoexcept |
Move constructs a reentrant_put_transaction, transferring the state from the source.
i_source | source to move from. It is left in a valid but indeterminate state. |
|
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 reentrant_put_transaction, transferring the state from the source.
i_source | source to move from. It is left in a valid but indeterminate state. |
|
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 |
Tries to 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.
If the operation can't be completed with the specified progress guarantee, this function returns nullptr to indicate a failure, and has no observable effects. This function fails if:
i_progress_guarantee | progress guarantee to respect |
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: nothing.
|
inlinenoexcept |
Tries to allocate 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.
If the operation can't be completed with the specified progress guarantee, this function returns nullptr to indicate a failure, and has no observable effects. This function fails if:
i_progress_guarantee | progress guarantee to respect |
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: what the copy constructor of the element throws (conditionally noexcept)
Exception guarantee: strong (in case of exception the function has no observable effects)
|
inlinenoexcept |
Tries to allocate 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.
If the operation can't be completed with the specified progress guarantee, this function returns nullptr to indicate a failure, and has no observable effects. This function fails if:
i_progress_guarantee | progress guarantee to respect |
i_source_range | to be copied |
Requires:
Complexity: Unspecified.
Effects on iterators: no iterator is invalidated
Throws: what the copy constructor of the element throws (conditionally noexcept)
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 does not hold the state of a transaction.
|
inlineexplicitnoexcept |
Returns true whether this object is bound to a transaction. Same to !consume_operation::empty.
|
inlinenoexcept |
Returns a pointer to the target queue if a transaction is bound, otherwise returns nullptr
|
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 reentrant_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 reentrant_put_transaction.