Template Class RelativePointer

Inheritance Relationships

Base Type

Class Documentation

template<typename T>
class RelativePointer : public iox::rp::BaseRelativePointer

typed version so we can use operator->

Public Types

using const_ptr_t = const T*
using ptr_t = T*

Public Functions

RelativePointer() noexcept = default

default constructs a RelativePointer as a logical nullptr

RelativePointer(ptr_t ptr, id_t id) noexcept

constructs a RelativePointer pointing to the same pointee as ptr in a segment identified by id

Parameters:
  • ptr[in] the pointer whose pointee shall be the same for this

  • id[in] is the unique id of the segment

RelativePointer(offset_t offset, id_t id) noexcept

constructs a RelativePointer from a given offset and segment id

Parameters:
  • offset[in] is the offset

  • id[in] is the unique id of the segment

RelativePointer(ptr_t ptr) noexcept

constructs a RelativePointer pointing to the same pointee as ptr

Parameters:

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

RelativePointer &operator=(ptr_t ptr) noexcept

assigns the RelativePointer to point to the same pointee as ptr

Parameters:

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

Returns:

reference to self

template<typename U = T>
std::enable_if<!std::is_void<U>::value, U&>::type operator*() noexcept

dereferencing operator which returns a reference to the underlying object

Template Parameters:

U – a template parameter to enable the dereferencing operator only for non-void T

Returns:

a reference to the underlying object

T *operator->() noexcept

access to the underlying object

Returns:

a pointer to the underlying object

template<typename U = T>
std::enable_if<!std::is_void<U>::value, const U&>::type operator*() const noexcept

dereferencing operator which returns a const reference to the underlying object

Template Parameters:

U – a template parameter to enable the dereferencing operator only for non-void T

Returns:

a const reference to the underlying object

T *operator->() const noexcept

read-only access to the underlying object

Returns:

a const pointer to the underlying object

T *get() const noexcept

access the underlying object

Returns:

a pointer to the underlying object

operator T*() const noexcept

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

Returns:

a pointer of type T pointing to the underlying object

bool operator==(T *const ptr) const noexcept

checks if this and ptr point to the same pointee

Parameters:

ptr[in] is the pointer whose pointee is compared with this’ pointee

Returns:

true if the pointees are equal, otherwise false

bool operator!=(T *const ptr) const noexcept

checks if this and ptr point not to the same pointee

Parameters:

ptr[in] is the pointer whose pointee is compared with this’ pointee

Returns:

true if the pointees are not equal, otherwise false