iceoryx_doc  1.0.1
Public Types | Public Member Functions | Static Public Attributes | List of all members
iox::rp::RelativePointerData Class Reference

This are the data for a relative pointer. To be able so safely be used in the shared memory and prevent torn writes/reads, the class must not be larger than 64 bits and trivially copy-able. More...

#include <relative_pointer_data.hpp>

Public Types

using id_t = uint16_t
 
using offset_t = uint64_t
 

Public Member Functions

constexpr RelativePointerData () noexcept=default
 Default constructed RelativePointerData which is logically equal to a nullptr.
 
constexpr RelativePointerData (id_t id, offset_t offset) noexcept
 constructs a RelativePointerData from a given offset and segment id More...
 
id_t id () const noexcept
 Getter for the id which identifies the segment. More...
 
offset_t offset () const noexcept
 Getter for the offset within the segment. More...
 
void reset () noexcept
 Resets the pointer to a logically nullptr.
 
bool isLogicalNullptr () const noexcept
 Checks if the pointer is logically a nullptr. More...
 

Static Public Attributes

static constexpr id_t ID_RANGE {std::numeric_limits<id_t>::max()}
 
static constexpr id_t NULL_POINTER_ID {ID_RANGE}
 
static constexpr id_t MAX_VALID_ID {ID_RANGE - 1U}
 
static constexpr offset_t OFFSET_RANGE {(1ULL << 48U) - 1U}
 id_t is 16 bit and the offset consumes the remaining 48 bits -> offset range is 2^48 - 1
 
static constexpr offset_t NULL_POINTER_OFFSET {OFFSET_RANGE}
 
static constexpr offset_t MAX_VALID_OFFSET {OFFSET_RANGE - 1U}
 
static constexpr offset_t LOGICAL_NULLPTR {NULL_POINTER_OFFSET << 16 | NULL_POINTER_ID}
 

Detailed Description

This are the data for a relative pointer. To be able so safely be used in the shared memory and prevent torn writes/reads, the class must not be larger than 64 bits and trivially copy-able.

Constructor & Destructor Documentation

◆ RelativePointerData()

constexpr iox::rp::RelativePointerData::RelativePointerData ( id_t  id,
offset_t  offset 
)
constexprnoexcept

constructs a RelativePointerData from a given offset and segment id

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

Member Function Documentation

◆ id()

id_t iox::rp::RelativePointerData::id ( ) const
noexcept

Getter for the id which identifies the segment.

Returns
the id which identifies the segment

◆ isLogicalNullptr()

bool iox::rp::RelativePointerData::isLogicalNullptr ( ) const
noexcept

Checks if the pointer is logically a nullptr.

Returns
true if logically a nullptr otherwise false

◆ offset()

offset_t iox::rp::RelativePointerData::offset ( ) const
noexcept

Getter for the offset within the segment.

Returns
the offset

Member Data Documentation

◆ ID_RANGE

constexpr id_t iox::rp::RelativePointerData::ID_RANGE {std::numeric_limits<id_t>::max()}
staticconstexpr
Note
the maximum number of available ids

◆ LOGICAL_NULLPTR

constexpr offset_t iox::rp::RelativePointerData::LOGICAL_NULLPTR {NULL_POINTER_OFFSET << 16 | NULL_POINTER_ID}
staticconstexpr
Note
internal representation of a nullptr

◆ MAX_VALID_ID

constexpr id_t iox::rp::RelativePointerData::MAX_VALID_ID {ID_RANGE - 1U}
staticconstexpr
Note
the maximum number of valid ids

◆ MAX_VALID_OFFSET

constexpr offset_t iox::rp::RelativePointerData::MAX_VALID_OFFSET {OFFSET_RANGE - 1U}
staticconstexpr
Note
the maximum offset which can be represented

◆ NULL_POINTER_ID

constexpr id_t iox::rp::RelativePointerData::NULL_POINTER_ID {ID_RANGE}
staticconstexpr
Note
this represents the id of a logically nullptr

◆ NULL_POINTER_OFFSET

constexpr offset_t iox::rp::RelativePointerData::NULL_POINTER_OFFSET {OFFSET_RANGE}
staticconstexpr
Note
this represents the offset of a logically nullptr;

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