Skip to content

iox::rp::RelativePointer🔗

typed version so we can use operator-> More...

#include <relative_pointer.hpp>

Inherits from iox::rp::BaseRelativePointer

Public Functions🔗

Name
RelativePointer(ptr_t ptr, id_t id)
constructs a RelativePointer pointing to the same pointee as ptr in a segment identified by id
RelativePointer(offset_t offset, id_t id)
constructs a RelativePointer from a given offset and segment id
RelativePointer(ptr_t ptr =nullptr)
constructs a RelativePointer pointing to the same pointee as ptr
RelativePointer(const BaseRelativePointer & other)
creates a RelativePointer from a BaseRelativePointer
RelativePointer & operator=(const BaseRelativePointer & other)
assign this to point to the same pointee as the BaseRelativePointer other
RelativePointer & operator=(ptr_t ptr)
assigns the RelativePointer to point to the same pointee as ptr
template \\
std::enable_if\::value, U & >::type
operator*()
dereferencing operator which returns a reference to the underlying object
T * operator->()
access to the underlying object
template \\
std::enable_if\::value, const U & >::type
operator*() const
dereferencing operator which returns a const reference to the underlying object
T * operator->() const
read-only access to the underlying object
T * get() const
access the underlying object
operator T*() const
converts the RelativePointer to a pointer of the type of the underlying object
bool operator==(T *const ptr) const
checks if this and ptr point to the same pointee
bool operator!=(T *const ptr) const
checks if this and ptr point not to the same pointee

Additional inherited members🔗

Public Types inherited from iox::rp::BaseRelativePointer

Name
using uint64_t id_t
using void * ptr_t
using const void *const const_ptr_t
using std::uintptr_t offset_t

Public Functions inherited from iox::rp::BaseRelativePointer

Name
BaseRelativePointer(ptr_t ptr, id_t id)
constructs a BaseRelativePointer pointing to the same pointee as ptr in a segment identified by id
BaseRelativePointer(offset_t offset, id_t id)
constructs a BaseRelativePointer from a given offset and segment id
BaseRelativePointer(ptr_t ptr =nullptr)
constructs a BaseRelativePointer pointing to the same pointer as ptr
BaseRelativePointer(const BaseRelativePointer & other)
copy constructor
BaseRelativePointer(BaseRelativePointer && other)
move constructor
id_t getId() const
returns the id which identifies the segment
offset_t getOffset() const
returns the offset
ptr_t getBasePtr() const
get the base pointer associated with this' id
offset_t computeOffset(ptr_t ptr) const
get the offset from the start address of the segment and ptr
ptr_t computeRawPtr() const
get the pointer from stored id and offset
id_t registerPtr(const ptr_t ptr, uint64_t size =0U)
registers a memory segment at ptr with size of a new id
bool registerPtr(const id_t id, const ptr_t ptr, uint64_t size =0U)
tries to register a memory segment with a given size starting at ptr to a given id
bool unregisterPtr(const id_t id)
unregisters ptr with given id
ptr_t getBasePtr(const id_t id)
get the base ptr associated with the given id
void unregisterAll()
unregisters all ptr id pairs (leads to initial state)
offset_t getOffset(const id_t id, const_ptr_t ptr)
get the offset from id and ptr
ptr_t getPtr(const id_t id, const offset_t offset)
get the pointer from id and offset ("inverse" to getOffset)
id_t searchId(ptr_t ptr)
get the id for a given ptr
bool isValid(id_t id)
checks if given id is valid
PointerRepository< id_t, ptr_t > & getRepository()
returns the pointer repository

Public Attributes inherited from iox::rp::BaseRelativePointer

Name
constexpr id_t NULL_POINTER_ID
constexpr offset_t NULL_POINTER_OFFSET

Protected Attributes inherited from iox::rp::BaseRelativePointer

Name
id_t m_id
offset_t m_offset

Detailed Description🔗

template <typename T >
class iox::rp::RelativePointer;

typed version so we can use operator->

Public Functions Documentation🔗

function RelativePointer🔗

inline RelativePointer(
    ptr_t ptr,
    id_t id
)

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

Parameters:

  • ptr the pointer whose pointee shall be the same for this
  • id is the unique id of the segment

function RelativePointer🔗

inline RelativePointer(
    offset_t offset,
    id_t id
)

constructs a RelativePointer from a given offset and segment id

Parameters:

  • offset is the offset
  • id is the unique id of the segment

function RelativePointer🔗

inline RelativePointer(
    ptr_t ptr =nullptr
)

constructs a RelativePointer pointing to the same pointee as ptr

Parameters:

  • ptr the pointer whose pointee shall be the same for this

function RelativePointer🔗

inline RelativePointer(
    const BaseRelativePointer & other
)

creates a RelativePointer from a BaseRelativePointer

Parameters:

function operator=🔗

inline RelativePointer & operator=(
    const BaseRelativePointer & other
)

assign this to point to the same pointee as the BaseRelativePointer other

Parameters:

  • other the pointer whose pointee shall be the same for this

Return: reference to self

function operator=🔗

inline RelativePointer & operator=(
    ptr_t ptr
)

assigns the RelativePointer to point to the same pointee as ptr

Parameters:

  • ptr the pointer whose pointee shall be the same for this

Return: reference to self

function operator*🔗

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

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

Return: a reference to the underlying object

function operator->🔗

inline T * operator->()

access to the underlying object

Return: a pointer to the underlying object

function operator*🔗

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

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

Return: a const reference to the underlying object

function operator->🔗

T * operator->() const

read-only access to the underlying object

Return: a const pointer to the underlying object

function get🔗

inline T * get() const

access the underlying object

Return: a pointer to the underlying object

function operator T*🔗

inline operator T*() const

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

Return: a pointer of type T pointing to the underlying object

function operator==🔗

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

checks if this and ptr point to the same pointee

Parameters:

  • ptr is the pointer whose pointee is compared with this' pointee

Return: true if the pointees are equal, otherwise false

function operator!=🔗

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

checks if this and ptr point not to the same pointee

Parameters:

  • ptr is the pointer whose pointee is compared with this' pointee

Return: true if the pointees are not equal, otherwise false


Updated on 17 June 2021 at 11:15:26 CEST