iceoryx_doc  1.0.1
shared_memory_user.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 #ifndef IOX_POSH_RUNTIME_SHARED_MEMORY_USER_HPP
18 #define IOX_POSH_RUNTIME_SHARED_MEMORY_USER_HPP
19 
20 #include "iceoryx_posh/iceoryx_posh_types.hpp"
21 #include "iceoryx_utils/cxx/optional.hpp"
22 #include "iceoryx_utils/cxx/vector.hpp"
23 #include "iceoryx_utils/internal/posix_wrapper/shared_memory_object.hpp"
24 #include "iceoryx_utils/internal/relocatable_pointer/base_relative_pointer.hpp"
25 
26 
27 namespace iox
28 {
29 namespace runtime
30 {
33 {
34  public:
41  SharedMemoryUser(const bool doMapSharedMemoryIntoThread,
42  const size_t topicSize,
43  const uint64_t segmentId,
44  const rp::BaseRelativePointer::offset_t segmentManagerAddressOffset);
45 
46  private:
47  void openDataSegments(const uint64_t segmentId,
48  const rp::BaseRelativePointer::offset_t segmentManagerAddressOffset) noexcept;
49 
50  private:
51  cxx::optional<posix::SharedMemoryObject> m_shmObject;
52  cxx::vector<posix::SharedMemoryObject, MAX_SHM_SEGMENTS> m_dataShmObjects;
53 };
54 
55 } // namespace runtime
56 } // namespace iox
57 
58 #endif // IOX_POSH_RUNTIME_SHARED_MEMORY_USER_HPP
shared memory setup for the management segment user side
Definition: shared_memory_user.hpp:33
SharedMemoryUser(const bool doMapSharedMemoryIntoThread, const size_t topicSize, const uint64_t segmentId, const rp::BaseRelativePointer::offset_t segmentManagerAddressOffset)
Constructor.
Definition: service_description.hpp:29