Allows registration of memory segments with their start pointers and size. This class is used to resolve relative pointers in the corresponding address space of the application. Up to CAPACITY segments can be registered with MIN_ID = 1 to MAX_ID = CAPACITY - 1 id 0 is reserved and allows relative pointers to behave like normal pointers (which is equivalent to measure the offset relative to 0).
More...
#include <pointer_repository.hpp>
|
| PointerRepository () noexcept |
| default constructor
|
|
bool | registerPtr (id_t id, ptr_t ptr, uint64_t size) noexcept |
| registers the start pointer of the segment in another application with a specific id More...
|
|
id_t | registerPtr (const ptr_t ptr, uint64_t size=0U) noexcept |
| registers the start pointer of a segment with a specific size More...
|
|
bool | unregisterPtr (id_t id) noexcept |
| unregisters the id More...
|
|
void | unregisterAll () noexcept |
| unregisters all ids More...
|
|
ptr_t | getBasePtr (id_t id) const noexcept |
| gets the base pointer, i.e. the starting address, associated with id More...
|
|
id_t | searchId (ptr_t ptr) const noexcept |
| returns the id for a given pointer ptr More...
|
|
bool | isValid (id_t id) const noexcept |
| checks if given id is valid More...
|
|
void | print () const noexcept |
| prints the ids and their associated base pointers
|
|
|
static constexpr id_t | INVALID_ID = std::numeric_limits<id_t>::max() |
|
template<typename id_t, typename ptr_t, uint64_t CAPACITY = 10000U>
class iox::rp::PointerRepository< id_t, ptr_t, CAPACITY >
Allows registration of memory segments with their start pointers and size. This class is used to resolve relative pointers in the corresponding address space of the application. Up to CAPACITY segments can be registered with MIN_ID = 1 to MAX_ID = CAPACITY - 1 id 0 is reserved and allows relative pointers to behave like normal pointers (which is equivalent to measure the offset relative to 0).
◆ getBasePtr()
template<typename id_t , typename ptr_t , uint64_t CAPACITY>
gets the base pointer, i.e. the starting address, associated with id
- Parameters
-
- Returns
- the base pointer associated with the id
- Note
- for id 0 nullptr is returned, meaning we will later interpret a relative pointer by casting the offset into a pointer (i.e. we measure relative to 0)
-
we cannot distinguish between not registered and nullptr registered, but we do not need to
◆ isValid()
template<typename id_t , typename ptr_t , uint64_t CAPACITY>
checks if given id is valid
- Parameters
-
[in] | id | is the id to be checked |
- Returns
- true if id is valid, otherwise false
◆ registerPtr() [1/2]
template<typename id_t , typename ptr_t , uint64_t CAPACITY>
registers the start pointer of a segment with a specific size
- Parameters
-
[in] | ptr | is the start pointer of the segment |
[in] | size | is the size of the segment |
- Returns
- the id that identifies the segment
◆ registerPtr() [2/2]
template<typename id_t , typename ptr_t , uint64_t CAPACITY>
registers the start pointer of the segment in another application with a specific id
- Parameters
-
[in] | id | identifies the segment |
[in] | ptr | is the start pointer of the segment |
[in] | size | is the size of the segment |
- Returns
- true if the registration was successful, otherwise false
◆ searchId()
template<typename id_t , typename ptr_t , uint64_t CAPACITY>
returns the id for a given pointer ptr
- Parameters
-
[in] | ptr | is the pointer whose corresponding id is searched for |
- Returns
- the id the pointer was registered to
- Note
- implicitly interpret the pointer as a regular pointer if not found by setting id to 0 rationale: test cases work without registered shared memory and require this at the moment to avoid fundamental changes
◆ unregisterAll()
template<typename id_t , typename ptr_t , uint64_t CAPACITY>
unregisters all ids
- Attention
- the relative pointers corresponding to this id become unsafe to use
◆ unregisterPtr()
template<typename id_t , typename ptr_t , uint64_t CAPACITY>
unregisters the id
- Parameters
-
[in] | id | is the id to be unregistered |
- Returns
- true if successful, otherwise false
- Attention
- the relative pointers corresponding to this id become unsafe to use
- Note
- do not search for next lower registered index but we could do it here
The documentation for this class was generated from the following files:
- iceoryx_utils/internal/relocatable_pointer/pointer_repository.hpp
- iceoryx_utils/internal/relocatable_pointer/pointer_repository.inl