iceoryx_posh  2.0.2
gateway_base.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_GW_GATEWAY_BASE_HPP
18 #define IOX_POSH_GW_GATEWAY_BASE_HPP
19 
20 #include "iceoryx_posh/capro/service_description.hpp"
21 #include "iceoryx_posh/iceoryx_posh_types.hpp"
22 #include "iceoryx_posh/internal/popo/ports/interface_port.hpp"
23 
24 #include <memory>
25 
26 namespace iox
27 {
28 namespace capro
29 {
30 class CaproMessage;
31 }
32 
33 namespace popo
34 {
35 class InterfacePort;
36 }
37 
38 namespace gw
39 {
42 {
43  public:
44  using CaproMessage = capro::CaproMessage;
45 
48  GatewayBase(const capro::Interfaces f_interface) noexcept;
49 
50  GatewayBase& operator=(const GatewayBase& other) = delete;
51  GatewayBase(const GatewayBase& other) = delete;
52  GatewayBase(GatewayBase&& other) noexcept = default;
53  GatewayBase& operator=(GatewayBase&&) noexcept = default;
54 
55  virtual ~GatewayBase() noexcept;
58  bool getCaProMessage(CaproMessage& msg) noexcept;
59 
60  protected:
61  // Needed for unit testing
62  GatewayBase() noexcept = default;
63  capro::Interfaces getInterface() const noexcept;
64 
65  protected:
66  popo::InterfacePort m_interfaceImpl{nullptr};
67 };
68 
69 } // namespace gw
70 } // namespace iox
71 
72 #endif // IOX_POSH_GW_GATEWAY_BASE_HPP
Generic gateway for communication events.
Definition: gateway_base.hpp:42
GatewayBase(const capro::Interfaces f_interface) noexcept
Constructor for creating generic gateway based on type of interface.
bool getCaProMessage(CaproMessage &msg) noexcept
Get function for type of capro message - service or event or field.