iceoryx_doc  1.0.1
Public Member Functions | List of all members
iox::rp::RelativePointer< T > Class Template Reference

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

#include <relative_pointer.hpp>

Inheritance diagram for iox::rp::RelativePointer< T >:
Inheritance graph
[legend]
Collaboration diagram for iox::rp::RelativePointer< T >:
Collaboration graph
[legend]

Public Member Functions

 RelativePointer (ptr_t ptr, id_t id) noexcept
 constructs a RelativePointer pointing to the same pointee as ptr in a segment identified by id More...
 
 RelativePointer (offset_t offset, id_t id) noexcept
 constructs a RelativePointer from a given offset and segment id More...
 
 RelativePointer (ptr_t ptr=nullptr) noexcept
 constructs a RelativePointer pointing to the same pointee as ptr More...
 
 RelativePointer (const BaseRelativePointer &other) noexcept
 creates a RelativePointer from a BaseRelativePointer More...
 
RelativePointeroperator= (const BaseRelativePointer &other) noexcept
 assign this to point to the same pointee as the BaseRelativePointer other More...
 
RelativePointeroperator= (ptr_t ptr) noexcept
 assigns the RelativePointer to point to the same pointee as ptr More...
 
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 More...
 
T * operator-> () noexcept
 access to the underlying object More...
 
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 More...
 
T * operator-> () const noexcept
 read-only access to the underlying object More...
 
T * get () const noexcept
 access the underlying object More...
 
 operator T* () const noexcept
 converts the RelativePointer to a pointer of the type of the underlying object More...
 
bool operator== (T *const ptr) const noexcept
 checks if this and ptr point to the same pointee More...
 
bool operator!= (T *const ptr) const noexcept
 checks if this and ptr point not to the same pointee More...
 
- Public Member Functions inherited from iox::rp::BaseRelativePointer
 BaseRelativePointer (ptr_t ptr, id_t id) noexcept
 constructs a BaseRelativePointer pointing to the same pointee as ptr in a segment identified by id More...
 
 BaseRelativePointer (offset_t offset, id_t id) noexcept
 constructs a BaseRelativePointer from a given offset and segment id More...
 
 BaseRelativePointer (ptr_t ptr=nullptr) noexcept
 constructs a BaseRelativePointer pointing to the same pointer as ptr More...
 
 BaseRelativePointer (const BaseRelativePointer &other) noexcept
 copy constructor More...
 
 BaseRelativePointer (BaseRelativePointer &&other) noexcept
 move constructor More...
 
BaseRelativePointeroperator= (const BaseRelativePointer &other) noexcept
 copy assignment More...
 
BaseRelativePointeroperator= (void *ptr) noexcept
 assigns the BaseRelativePointer to point to the same pointee as ptr More...
 
BaseRelativePointeroperator= (BaseRelativePointer &&other) noexcept
 move assignment More...
 
ptr_t get () const noexcept
 access to the underlying object More...
 
id_t getId () const noexcept
 returns the id which identifies the segment More...
 
offset_t getOffset () const noexcept
 returns the offset More...
 
ptr_t getBasePtr () const noexcept
 get the base pointer associated with this' id More...
 
offset_t computeOffset (ptr_t ptr) const noexcept
 get the offset from the start address of the segment and ptr More...
 
ptr_t computeRawPtr () const noexcept
 get the pointer from stored id and offset More...
 

Additional Inherited Members

- Public Types inherited from iox::rp::BaseRelativePointer
using id_t = uint64_t
 
using ptr_t = void *
 
using const_ptr_t = const void *const
 
using offset_t = std::uintptr_t
 
- Static Public Member Functions inherited from iox::rp::BaseRelativePointer
static id_t registerPtr (const ptr_t ptr, uint64_t size=0U) noexcept
 registers a memory segment at ptr with size of a new id More...
 
static bool registerPtr (const id_t id, const ptr_t ptr, uint64_t size=0U) noexcept
 tries to register a memory segment with a given size starting at ptr to a given id More...
 
static bool unregisterPtr (const id_t id) noexcept
 unregisters ptr with given id More...
 
static ptr_t getBasePtr (const id_t id) noexcept
 get the base ptr associated with the given id More...
 
static void unregisterAll () noexcept
 unregisters all ptr id pairs (leads to initial state)
 
static offset_t getOffset (const id_t id, const_ptr_t ptr) noexcept
 get the offset from id and ptr More...
 
static ptr_t getPtr (const id_t id, const offset_t offset) noexcept
 get the pointer from id and offset ("inverse" to getOffset) More...
 
static id_t searchId (ptr_t ptr) noexcept
 get the id for a given ptr More...
 
static bool isValid (id_t id) noexcept
 checks if given id is valid More...
 
static PointerRepository< id_t, ptr_t > & getRepository () noexcept
 returns the pointer repository More...
 
- Static Public Attributes inherited from iox::rp::BaseRelativePointer
static constexpr id_t NULL_POINTER_ID = std::numeric_limits<id_t>::max()
 
static constexpr offset_t NULL_POINTER_OFFSET = std::numeric_limits<offset_t>::max()
 
- Protected Attributes inherited from iox::rp::BaseRelativePointer
id_t m_id {NULL_POINTER_ID}
 
offset_t m_offset {NULL_POINTER_OFFSET}
 

Detailed Description

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

typed version so we can use operator->

Constructor & Destructor Documentation

◆ RelativePointer() [1/4]

template<typename T >
iox::rp::RelativePointer< T >::RelativePointer ( ptr_t  ptr,
id_t  id 
)
inlinenoexcept

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

Parameters
[in]ptrthe pointer whose pointee shall be the same for this
[in]idis the unique id of the segment

◆ RelativePointer() [2/4]

template<typename T >
iox::rp::RelativePointer< T >::RelativePointer ( offset_t  offset,
id_t  id 
)
inlinenoexcept

constructs a RelativePointer from a given offset and segment id

Parameters
[in]offsetis the offset
[in]idis the unique id of the segment

◆ RelativePointer() [3/4]

template<typename T >
iox::rp::RelativePointer< T >::RelativePointer ( ptr_t  ptr = nullptr)
inlinenoexcept

constructs a RelativePointer pointing to the same pointee as ptr

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

◆ RelativePointer() [4/4]

template<typename T >
iox::rp::RelativePointer< T >::RelativePointer ( const BaseRelativePointer< T > &  other)
inlinenoexcept

creates a RelativePointer from a BaseRelativePointer

Parameters
[in]otheris the BaseRelativePointer

Member Function Documentation

◆ get()

template<typename T >
T * iox::rp::RelativePointer< T >::get
inlinenoexcept

access the underlying object

Returns
a pointer to the underlying object

◆ operator T*()

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

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

Returns
a pointer of type T pointing to the underlying object

◆ operator!=()

template<typename T >
bool iox::rp::RelativePointer< T >::operator!= ( T *const  ptr) const
inlinenoexcept

checks if this and ptr point not to the same pointee

Parameters
[in]ptris the pointer whose pointee is compared with this' pointee
Returns
true if the pointees are not equal, otherwise false

◆ operator*() [1/2]

template<typename T >
template<typename U >
std::enable_if<!std::is_void< U >::value, const U & >::type iox::rp::RelativePointer< T >::operator*
inlinenoexcept

dereferencing operator which returns a const reference to the underlying object

Template Parameters
Ua template parameter to enable the dereferencing operator only for non-void T
Returns
a const reference to the underlying object

◆ operator*() [2/2]

template<typename T >
template<typename U >
std::enable_if<!std::is_void< U >::value, U & >::type iox::rp::RelativePointer< T >::operator*
inlinenoexcept

dereferencing operator which returns a reference to the underlying object

Template Parameters
Ua template parameter to enable the dereferencing operator only for non-void T
Returns
a reference to the underlying object

◆ operator->() [1/2]

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

read-only access to the underlying object

Returns
a const pointer to the underlying object

◆ operator->() [2/2]

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

access to the underlying object

Returns
a pointer to the underlying object

◆ operator=() [1/2]

template<typename T >
RelativePointer< T > & iox::rp::RelativePointer< T >::operator= ( const BaseRelativePointer< T > &  other)
inlinenoexcept

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

Parameters
[in]otherthe pointer whose pointee shall be the same for this
Returns
reference to self

◆ operator=() [2/2]

template<typename T >
RelativePointer< T > & iox::rp::RelativePointer< T >::operator= ( ptr_t  ptr)
inlinenoexcept

assigns the RelativePointer to point to the same pointee as ptr

Parameters
[in]ptrthe pointer whose pointee shall be the same for this
Returns
reference to self

◆ operator==()

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

checks if this and ptr point to the same pointee

Parameters
[in]ptris the pointer whose pointee is compared with this' pointee
Returns
true if the pointees are equal, otherwise false

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