iceoryx_doc  1.0.1
port_pool_data.hpp
1 // Copyright (c) 2020 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_ROUDI_PORT_POOL_DATA_HPP
18 #define IOX_POSH_ROUDI_PORT_POOL_DATA_HPP
19 
20 #include "iceoryx_posh/iceoryx_posh_types.hpp"
21 #include "iceoryx_posh/internal/popo/building_blocks/condition_variable_data.hpp"
22 #include "iceoryx_posh/internal/popo/ports/application_port.hpp"
23 #include "iceoryx_posh/internal/popo/ports/interface_port.hpp"
24 #include "iceoryx_posh/internal/popo/ports/publisher_port_data.hpp"
25 #include "iceoryx_posh/internal/popo/ports/subscriber_port_data.hpp"
26 #include "iceoryx_posh/internal/runtime/node_data.hpp"
27 #include "iceoryx_utils/cxx/optional.hpp"
28 #include "iceoryx_utils/cxx/vector.hpp"
29 
30 namespace iox
31 {
32 namespace roudi
33 {
35 template <typename T, uint64_t Capacity>
37 {
38  public:
39  static constexpr uint64_t FIRST_ELEMENT = std::numeric_limits<uint64_t>::max();
40 
41  bool hasFreeSpace();
42 
43  template <typename... Targs>
44  T* insert(Targs&&... args);
45 
46  void erase(T* const element);
47 
48  cxx::vector<T*, Capacity> content();
49 
50  private:
51  cxx::vector<cxx::optional<T>, Capacity> m_data;
52 };
53 
55 {
60 
63 
64  // required to be atomic since a service can be offered or stopOffered while reading
65  // this variable in a user application
66  std::atomic<uint64_t> m_serviceRegistryChangeCounter{0};
67 };
68 
69 } // namespace roudi
70 } // namespace iox
71 
72 #include "iceoryx_posh/internal/roudi/port_pool_data.inl"
73 
74 #endif // IOX_POSH_ROUDI_PORT_POOL_DATA_BASE_HPP
workaround container until we have a fixed list with the needed functionality
Definition: port_pool_data.hpp:37
Definition: service_description.hpp:29
Definition: port_pool_data.hpp:55