iceoryx_posh  2.0.2
gateway_discovery.hpp
1 // Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // SPDX-License-Identifier: Apache-2.0
16 #ifndef IOX_POSH_GW_GATEWAY_DISCOVERY_HPP
17 #define IOX_POSH_GW_GATEWAY_DISCOVERY_HPP
18 
19 #include "iceoryx_posh/gateway/gateway_base.hpp"
20 #include "iceoryx_posh/iceoryx_posh_types.hpp"
21 
22 namespace iox
23 {
24 namespace capro
25 {
26 class CaproMessage;
27 }
28 namespace gw
29 {
30 class InterfacePort;
31 
33 template <typename Impl_T = GatewayBase>
35 {
36  public:
37  using CaproMessage = capro::CaproMessage;
38 
41  explicit GatewayDiscovery(const capro::Interfaces f_interface) noexcept
42  : m_impl(f_interface)
43  {
44  }
45 
48  bool getCaproMessage(CaproMessage& msg) noexcept
49  {
50  return m_impl.getCaProMessage(msg);
51  }
52 
53  protected:
54  // needed for unit testing
55  explicit GatewayDiscovery(Impl_T interfacePortImpl) noexcept
56  : m_impl(interfacePortImpl)
57  {
58  }
59 
60  private:
61  Impl_T m_impl;
62 };
63 } // namespace gw
64 } // namespace iox
65 
66 #endif // IOX_POSH_GW_GATEWAY_DISCOVERY_HPP
Discover the gateway.
Definition: gateway_discovery.hpp:35
GatewayDiscovery(const capro::Interfaces f_interface) noexcept
Constructor for discovering gateway based on type of interface.
Definition: gateway_discovery.hpp:41
bool getCaproMessage(CaproMessage &msg) noexcept
Get function for type of capro message - service or event or field.
Definition: gateway_discovery.hpp:48