18 #ifndef IOX_UTILS_RELOCATABLE_POINTER_POINTER_REPOSITORY_HPP
19 #define IOX_UTILS_RELOCATABLE_POINTER_POINTER_REPOSITORY_HPP
21 #include "iceoryx_utils/cxx/vector.hpp"
36 template <
typename id_t,
typename ptr_t, u
int64_t CAPACITY = 10000U>
42 ptr_t basePtr{
nullptr};
43 ptr_t endPtr{
nullptr};
49 static constexpr
size_t MIN_ID = 1U;
50 static constexpr
size_t MAX_ID = CAPACITY - 1U;
53 static constexpr id_t INVALID_ID = std::numeric_limits<id_t>::max();
63 bool registerPtr(id_t
id, ptr_t ptr, uint64_t size) noexcept;
69 id_t
registerPtr(
const ptr_t ptr, uint64_t size = 0U) noexcept;
89 id_t
searchId(ptr_t ptr)
const noexcept;
94 bool isValid(id_t
id)
const noexcept;
97 void print()
const noexcept;
107 uint64_t m_maxRegistered{0U};
113 #include "iceoryx_utils/internal/relocatable_pointer/pointer_repository.inl"
C++11 compatible vector implementation. We needed to do some adjustments in the API since we do not u...
Definition: vector.hpp:34
Allows registration of memory segments with their start pointers and size. This class is used to reso...
Definition: pointer_repository.hpp:38
bool isValid(id_t id) const noexcept
checks if given id is valid
Definition: pointer_repository.inl:135
ptr_t getBasePtr(id_t id) const noexcept
gets the base pointer, i.e. the starting address, associated with id
Definition: pointer_repository.inl:101
PointerRepository() noexcept
default constructor
Definition: pointer_repository.inl:28
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
Definition: pointer_repository.inl:34
void unregisterAll() noexcept
unregisters all ids
Definition: pointer_repository.inl:91
bool unregisterPtr(id_t id) noexcept
unregisters the id
Definition: pointer_repository.inl:74
void print() const noexcept
prints the ids and their associated base pointers
Definition: pointer_repository.inl:141
id_t searchId(ptr_t ptr) const noexcept
returns the id for a given pointer ptr
Definition: pointer_repository.inl:116
building block to easily create free function for logging in a library context
Definition: lockfree_queue.hpp:28