iceoryx_doc  1.0.1
relocatable_pointer.hpp
1 // Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2 // Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 // SPDX-License-Identifier: Apache-2.0
17 
18 #ifndef IOX_UTILS_RELOCATABLE_POINTER_RELOCATABLE_POINTER_HPP
19 #define IOX_UTILS_RELOCATABLE_POINTER_RELOCATABLE_POINTER_HPP
20 
21 #include "base_relocatable_pointer.hpp"
22 
23 namespace iox
24 {
25 namespace rp
26 {
28 template <typename T>
30 {
31  public:
33  RelocatablePointer() noexcept;
34 
37  RelocatablePointer(const T* ptr) noexcept;
38 
41  RelocatablePointer(const BaseRelocatablePointer& other) noexcept;
42 
45  RelocatablePointer(T* rawPtr) noexcept;
46 
50  RelocatablePointer& operator=(const BaseRelocatablePointer& other) noexcept;
51 
54  T& operator*() noexcept;
55 
58  T* operator->() noexcept;
59 
62  const T& operator*() const noexcept;
63 
66  const T* operator->() const noexcept;
67 
71  T& operator[](uint64_t index) noexcept;
72 
75  operator T*() const noexcept;
76 };
77 } // namespace rp
78 } // namespace iox
79 
80 #include "iceoryx_utils/internal/relocatable_pointer/relocatable_pointer.inl"
81 
82 #endif // IOX_UTILS_RELOCATABLE_POINTER_RELOCATABLE_POINTER_HPP
pointer class to use when pointer and pointee are located in the same shared memory segment We can ha...
Definition: base_relocatable_pointer.hpp:44
typed version so we can use operator->
Definition: relocatable_pointer.hpp:30
RelocatablePointer & operator=(const BaseRelocatablePointer &other) noexcept
assign this to point to the same pointee as the BaseRelocatablePointer other
Definition: relocatable_pointer.inl:52
T & operator[](uint64_t index) noexcept
returns a reference to the memory location of the underlying object + an offset
Definition: relocatable_pointer.inl:84
T * operator->() noexcept
access to the underlying object in shared memory
Definition: relocatable_pointer.inl:66
T & operator*() noexcept
dereferencing operator which returns a reference to the pointee
Definition: relocatable_pointer.inl:60
RelocatablePointer() noexcept
default constructs a logical nullptr
Definition: relocatable_pointer.inl:28
building block to easily create free function for logging in a library context
Definition: lockfree_queue.hpp:28