iceoryx_doc
1.0.1
|
pointer class to use when pointer and pointee are located in the same shared memory segment We can have the following scenario: Pointer p points to object X of type T and both are stored in shared memory segment S. More...
#include <base_relocatable_pointer.hpp>
Public Types | |
using | offset_t = std::ptrdiff_t |
Public Member Functions | |
BaseRelocatablePointer () noexcept | |
default constructs a logical nullptr | |
BaseRelocatablePointer (const void *ptr) noexcept | |
creates a relocatable pointer pointing to the same pointee as ptr More... | |
BaseRelocatablePointer (const BaseRelocatablePointer &other) noexcept | |
copy constructor More... | |
BaseRelocatablePointer (BaseRelocatablePointer &&other) noexcept | |
move constructor More... | |
BaseRelocatablePointer & | operator= (const BaseRelocatablePointer &other) noexcept |
copy assignment More... | |
BaseRelocatablePointer & | operator= (const void *rawPtr) noexcept |
assign BaseRelocatablePointer to point to the same pointee as rawPtr More... | |
BaseRelocatablePointer & | operator= (BaseRelocatablePointer &&other) noexcept |
move assignment More... | |
const void * | operator* () const noexcept |
read-only access to the underlying object in shared memory More... | |
operator bool () const noexcept | |
checks if this is not a logical nullptr More... | |
bool | operator! () const noexcept |
checks if this is a logical nullptr More... | |
const void * | get () const noexcept |
access to the underlying object in shared memory More... | |
offset_t | getOffset () const noexcept |
returns the offset More... | |
Static Public Attributes | |
static constexpr offset_t | NULL_POINTER_OFFSET = std::numeric_limits<offset_t>::max() |
Protected Member Functions | |
offset_t | computeOffset (const void *ptr) const noexcept |
void * | computeRawPtr () const noexcept |
Protected Attributes | |
offset_t | m_offset {NULL_POINTER_OFFSET} |
Friends | |
template<typename T > | |
class | RelocatablePointer |
pointer class to use when pointer and pointee are located in the same shared memory segment We can have the following scenario: Pointer p points to object X of type T and both are stored in shared memory segment S.
Shared Memory S: p X |__________________^ App1 a1 b1 c1 App2 a2 b2 c2
Let a1, b1, c1 be the addresses of segment S, pointer p and object X in application 1 and similarly a2, b2, and c2 in application 2. If application 2 maps the memory differently they will be shifted by some common offset d depending on the individual memory mapping: a2=a1+d, b2=b1+d, c2=c1+d This is why storing a raw pointer to X will not be sufficient, the value of c1 will not point to X in application 2. However, storing the difference between the location of p and X will work since it is an invariant in both address spaces.
|
explicitnoexcept |
creates a relocatable pointer pointing to the same pointee as ptr
[in] | ptr | the pointer whose pointee shall be the same for this |
|
noexcept |
copy constructor
[in] | other | is the copy origin |
|
noexcept |
move constructor
[in] | other | is the move origin |
|
noexcept |
access to the underlying object in shared memory
|
noexcept |
returns the offset
|
noexcept |
checks if this is not a logical nullptr
|
noexcept |
checks if this is a logical nullptr
|
noexcept |
read-only access to the underlying object in shared memory
|
noexcept |
move assignment
[in] | other | is the move origin |
|
noexcept |
copy assignment
[in] | other | is the copy origin |
|
noexcept |
assign BaseRelocatablePointer to point to the same pointee as rawPtr
[in] | rawPtr | the pointer whose pointee shall be the same for this |