iceoryx_doc  1.0.1
base_port.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_POPO_PORTS_BASE_PORT_HPP
18 #define IOX_POSH_POPO_PORTS_BASE_PORT_HPP
19 
20 #include "iceoryx_posh/iceoryx_posh_types.hpp"
21 #include "iceoryx_posh/internal/popo/ports/base_port_data.hpp"
22 
23 namespace iox
24 {
25 namespace popo
26 {
42 class BasePort
43 {
44  public:
45  using MemberType_t = BasePortData;
46 
47  explicit BasePort(MemberType_t* const basePortDataPtr) noexcept;
48 
49  BasePort(const BasePort& other) = delete;
50  BasePort& operator=(const BasePort&) = delete;
51  BasePort(BasePort&&) noexcept;
52  BasePort& operator=(BasePort&&) noexcept;
53  virtual ~BasePort() = default;
54 
59  operator bool() const noexcept;
60 
63  capro::ServiceDescription getCaProServiceDescription() const noexcept;
64 
67  RuntimeName_t getRuntimeName() const noexcept;
68 
71  UniquePortId getUniqueID() const noexcept;
72 
75  NodeName_t getNodeName() const noexcept;
76 
78  void destroy() noexcept;
79 
82  bool toBeDestroyed() const noexcept;
83 
84  protected:
85  const MemberType_t* getMembers() const noexcept;
86  MemberType_t* getMembers() noexcept;
87 
88  private:
89  MemberType_t* m_basePortDataPtr;
90 };
91 
92 } // namespace popo
93 } // namespace iox
94 
95 #include "iceoryx_posh/internal/popo/ports/base_port.inl"
96 
97 #endif // IOX_POSH_POPO_PORTS_BASE_PORT_HPP
this class is the base for all ports. it is constructed from a member pointer and is only movable....
Definition: base_port.hpp:43
NodeName_t getNodeName() const noexcept
returns node name for the active port
bool toBeDestroyed() const noexcept
Checks whether port can be destroyed.
UniquePortId getUniqueID() const noexcept
Gets Id of the active port.
RuntimeName_t getRuntimeName() const noexcept
Gets name of the application's runtime for the active port.
capro::ServiceDescription getCaProServiceDescription() const noexcept
Reads Type of actual CaPro Port (publisher/subscriber...)
void destroy() noexcept
Indicate that this port can be destroyed.
Definition: service_description.hpp:29
Defines different base port data.
Definition: base_port_data.hpp:34