Thrill
0.1
|
A pinned / pin-counted pointer to a ByteBlock.
By holding a pin, it is a guaranteed that the ByteBlock's underlying memory is loaded in RAM. Since pins are counted per thread, the PinnedByteBlockPtr is a counting pointer plus a thread id.
Be careful to move PinnedByteBlockPtr as must as possible, since copying costs a pinning and an unpinning operation, whereas moving is free.
Definition at line 205 of file byte_block.hpp.
#include <byte_block.hpp>
Public Member Functions | |
PinnedByteBlockPtr () noexcept=default | |
default ctor: contains a nullptr pointer. More... | |
PinnedByteBlockPtr (const PinnedByteBlockPtr &pbb) noexcept | |
copy-ctor: increment underlying's pin count More... | |
PinnedByteBlockPtr (PinnedByteBlockPtr &&pbb) noexcept | |
move-ctor: move underlying's pin More... | |
~PinnedByteBlockPtr () | |
destructor: remove pin More... | |
size_t | local_worker_id () const |
local worker id of holder of pin More... | |
PinnedByteBlockPtr & | operator= (PinnedByteBlockPtr &pbb) noexcept |
copy-assignment: transfer underlying's pin count More... | |
PinnedByteBlockPtr & | operator= (PinnedByteBlockPtr &&pbb) noexcept |
move-assignment: move underlying's pin More... | |
ByteBlockPtr | ReleasePin () && |
relinquish pin More... | |
Public Member Functions inherited from ByteBlockPtr | |
ByteBlockPtr ()=default | |
default ctor: returns an empty ByteBlockPtr More... | |
Public Member Functions inherited from CountingPtr< Type, Deleter > | |
CountingPtr () noexcept | |
default constructor: contains a nullptr pointer. More... | |
CountingPtr (std::nullptr_t) noexcept | |
implicit conversion from nullptr_t: contains a nullptr pointer. More... | |
CountingPtr (Type *ptr) noexcept | |
constructor from pointer: initializes new reference to ptr. More... | |
CountingPtr (const CountingPtr &other) noexcept | |
copy-constructor: also initializes new reference to ptr. More... | |
template<typename Subclass , typename = typename std::enable_if< std::is_convertible<Subclass*, Type*>::value, void>::type> | |
CountingPtr (const CountingPtr< Subclass, Deleter > &other) noexcept | |
copy-constructor: also initializes new reference to ptr. More... | |
CountingPtr (CountingPtr &&other) noexcept | |
move-constructor: just moves pointer, does not change reference counts. More... | |
template<typename Subclass , typename = typename std::enable_if< std::is_convertible<Subclass*, Type*>::value, void>::type> | |
CountingPtr (CountingPtr< Subclass, Deleter > &&other) noexcept | |
move-constructor: just moves pointer, does not change reference counts. More... | |
CountingPtr & | operator= (const CountingPtr &other) noexcept |
template<typename Subclass , typename = typename std::enable_if< std::is_convertible<Subclass*, Type*>::value, void>::type> | |
CountingPtr & | operator= (const CountingPtr< Subclass, Deleter > &other) noexcept |
CountingPtr & | operator= (CountingPtr &&other) noexcept |
move-assignment operator: move reference of other to current object. More... | |
template<typename Subclass , typename = typename std::enable_if< std::is_convertible<Subclass*, Type*>::value, void>::type> | |
CountingPtr & | operator= (CountingPtr< Subclass, Deleter > &&other) noexcept |
move-assignment operator: move reference of other to current object. More... | |
~CountingPtr () | |
destructor: decrements reference count in ptr. More... | |
Type & | operator* () const noexcept |
return the enclosed object as reference. More... | |
Type * | operator-> () const noexcept |
return the enclosed pointer. More... | |
Type * | get () const noexcept |
return the enclosed pointer. More... | |
bool | valid () const noexcept |
test for a non-nullptr pointer More... | |
operator bool () const noexcept | |
cast to bool checks for a nullptr pointer More... | |
bool | empty () const noexcept |
test for a nullptr pointer More... | |
bool | unique () const noexcept |
if the object is referred by this CountingPtr only More... | |
size_t | use_count () const noexcept |
void | reset () |
release contained pointer, frees object if this is the last reference. More... | |
void | swap (CountingPtr &b) noexcept |
void | unify () |
make and refer a copy if the original object was shared. More... | |
bool | operator== (const CountingPtr &other) const noexcept |
test equality of only the pointer values. More... | |
bool | operator!= (const CountingPtr &other) const noexcept |
test inequality of only the pointer values. More... | |
bool | operator== (Type *other) const noexcept |
test equality of only the address pointed to More... | |
bool | operator!= (Type *other) const noexcept |
test inequality of only the address pointed to More... | |
bool | operator< (const CountingPtr &other) const noexcept |
compare the pointer values. More... | |
bool | operator<= (const CountingPtr &other) const noexcept |
compare the pointer values. More... | |
bool | operator> (const CountingPtr &other) const noexcept |
compare the pointer values. More... | |
bool | operator>= (const CountingPtr &other) const noexcept |
compare the pointer values. More... | |
bool | operator< (Type *other) const noexcept |
compare the pointer values. More... | |
bool | operator<= (Type *other) const noexcept |
compare the pointer values. More... | |
bool | operator> (Type *other) const noexcept |
compare the pointer values. More... | |
bool | operator>= (Type *other) const noexcept |
compare the pointer values. More... | |
Private Member Functions | |
PinnedByteBlockPtr (ByteBlock *ptr, size_t local_worker_id) noexcept | |
protected ctor for calling from Acquire(). More... | |
PinnedByteBlockPtr (ByteBlockPtr &&ptr, size_t local_worker_id) noexcept | |
protected ctor for calling from Acquire(). More... | |
Private Attributes | |
size_t | local_worker_id_ |
local worker id of holder of pin More... | |
Additional Inherited Members | |
Public Types inherited from CountingPtr< Type, Deleter > | |
using | element_type = Type |
contained type. More... | |
Protected Member Functions inherited from ByteBlockPtr | |
ByteBlockPtr (const PinnedByteBlockPtr &p) | |
(protected) ctor from PinnedByteBlockPtr More... | |
ByteBlockPtr (PinnedByteBlockPtr &&p) | |
(protected) ctor from PinnedByteBlockPtr More... | |
ByteBlockPtr (ByteBlock *ptr) | |
(protected) ctor from plain pointer More... | |
|
defaultnoexcept |
default ctor: contains a nullptr pointer.
|
inlinenoexcept |
copy-ctor: increment underlying's pin count
Definition at line 212 of file byte_block.hpp.
References ByteBlock::IncPinCount().
|
inlinenoexcept |
move-ctor: move underlying's pin
Definition at line 218 of file byte_block.hpp.
|
inline |
destructor: remove pin
Definition at line 250 of file byte_block.hpp.
References ByteBlock::DecPinCount().
|
inlineprivatenoexcept |
protected ctor for calling from Acquire().
Definition at line 265 of file byte_block.hpp.
|
inlineprivatenoexcept |
protected ctor for calling from Acquire().
Definition at line 269 of file byte_block.hpp.
|
inline |
local worker id of holder of pin
Definition at line 255 of file byte_block.hpp.
|
inlinenoexcept |
copy-assignment: transfer underlying's pin count
Definition at line 224 of file byte_block.hpp.
References ByteBlock::DecPinCount(), and CountingPtr< Type, Deleter >::operator=().
|
inlinenoexcept |
move-assignment: move underlying's pin
Definition at line 237 of file byte_block.hpp.
References ByteBlock::DecPinCount(), and CountingPtr< Type, Deleter >::operator=().
|
inline |
|
private |
local worker id of holder of pin
Definition at line 273 of file byte_block.hpp.