iceoryx_doc  1.0.1
Public Types | Public Member Functions | Static Public Attributes | List of all members
iox::rp::AtomicRelocatablePointer< T > Class Template Reference

minimalistic relocatable pointer that can be written and read atomically and can be stored safely in shared memory. As the basic RelocatablePointer, it must point to something in the same shared memory segment as itself since the internally used offset must be an invariant different across adress spaces. Rationale: the default RelocatablePointer cannot be used in an atomic since the copy ctor is nontrivial. More...

#include <atomic_relocatable_pointer.hpp>

Public Types

using offset_t = std::ptrdiff_t
 

Public Member Functions

 AtomicRelocatablePointer (const T *ptr=nullptr) noexcept
 creates an AtomicRelocatablePointer pointing to the same pointee as ptr More...
 
 AtomicRelocatablePointer (const AtomicRelocatablePointer &)=delete
 
AtomicRelocatablePointeroperator= (const AtomicRelocatablePointer &other)=delete
 
 AtomicRelocatablePointer (AtomicRelocatablePointer &&other)=delete
 
AtomicRelocatablePointeroperator= (AtomicRelocatablePointer &&other)=delete
 
AtomicRelocatablePointeroperator= (const T *ptr) noexcept
 assign AtomicRelocatablePointer to point to the same pointee as ptr More...
 
T * operator-> () const noexcept
 access to the underlying object in shared memory More...
 
T & operator* () const noexcept
 dereferencing operator which returns a reference to the pointee More...
 
 operator T* () const noexcept
 converts the AtomicRelocatablePointer to a pointer of type of the underlying object More...
 

Static Public Attributes

static constexpr offset_t NULL_POINTER_OFFSET = std::numeric_limits<offset_t>::max()
 

Detailed Description

template<typename T>
class iox::rp::AtomicRelocatablePointer< T >

minimalistic relocatable pointer that can be written and read atomically and can be stored safely in shared memory. As the basic RelocatablePointer, it must point to something in the same shared memory segment as itself since the internally used offset must be an invariant different across adress spaces. Rationale: the default RelocatablePointer cannot be used in an atomic since the copy ctor is nontrivial.

Constructor & Destructor Documentation

◆ AtomicRelocatablePointer() [1/2]

template<typename T >
iox::rp::AtomicRelocatablePointer< T >::AtomicRelocatablePointer ( const T *  ptr = nullptr)
inlinenoexcept

creates an AtomicRelocatablePointer pointing to the same pointee as ptr

Parameters
[in]ptrthe pointer whose pointee shall be the same for this

◆ AtomicRelocatablePointer() [2/2]

template<typename T >
iox::rp::AtomicRelocatablePointer< T >::AtomicRelocatablePointer ( const AtomicRelocatablePointer< T > &  )
delete
Todo:
: can be implemented when needed, note that the offset must be recomputed during the move/copy

Member Function Documentation

◆ operator T*()

template<typename T >
iox::rp::AtomicRelocatablePointer< T >::operator T*
inlinenoexcept

converts the AtomicRelocatablePointer to a pointer of type of the underlying object

Returns
a pointer of type T pointing to the underlying object

◆ operator*()

template<typename T >
T & iox::rp::AtomicRelocatablePointer< T >::operator*
inlinenoexcept

dereferencing operator which returns a reference to the pointee

Returns
a reference to the pointee

◆ operator->()

template<typename T >
T * iox::rp::AtomicRelocatablePointer< T >::operator->
inlinenoexcept

access to the underlying object in shared memory

Returns
a pointer to the underlying object

◆ operator=()

template<typename T >
AtomicRelocatablePointer< T > & iox::rp::AtomicRelocatablePointer< T >::operator= ( const T *  ptr)
inlinenoexcept

assign AtomicRelocatablePointer to point to the same pointee as ptr

Note
minimal set of required operators, can be extended later
Parameters
[in]ptrthe pointer whose pointee shall be the same for this
Returns
reference to self

The documentation for this class was generated from the following files: