iceoryx_doc  1.0.1
process.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_ROUDI_PROCESS_HPP
18 #define IOX_POSH_ROUDI_PROCESS_HPP
19 
20 #include "iceoryx_posh/internal/mepoo/segment_manager.hpp"
21 #include "iceoryx_posh/internal/roudi/introspection/process_introspection.hpp"
22 #include "iceoryx_posh/internal/roudi/port_manager.hpp"
23 #include "iceoryx_posh/internal/runtime/ipc_interface_user.hpp"
24 #include "iceoryx_posh/mepoo/chunk_header.hpp"
25 #include "iceoryx_posh/version/compatibility_check_level.hpp"
26 #include "iceoryx_posh/version/version_info.hpp"
27 #include "iceoryx_utils/cxx/list.hpp"
28 #include "iceoryx_utils/error_handling/error_handling.hpp"
29 #include "iceoryx_utils/posix_wrapper/posix_access_rights.hpp"
30 
31 #include <cstdint>
32 #include <ctime>
33 
34 namespace iox
35 {
36 namespace roudi
37 {
38 class Process
39 {
40  public:
48  Process(const RuntimeName_t& name,
49  const uint32_t pid,
50  const posix::PosixUser& user,
51  const bool isMonitored,
52  const uint64_t sessionId) noexcept;
53 
54  Process(const Process& other) = delete;
55  Process& operator=(const Process& other) = delete;
57  Process(Process&& other) = delete;
58  Process& operator=(Process&& other) = delete;
59  ~Process() = default;
60 
61  uint32_t getPid() const noexcept;
62 
63  const RuntimeName_t getName() const noexcept;
64 
65  void sendViaIpcChannel(const runtime::IpcMessage& data) noexcept;
66 
69  uint64_t getSessionId() noexcept;
70 
71  void setTimestamp(const mepoo::TimePointNs_t timestamp) noexcept;
72 
73  mepoo::TimePointNs_t getTimestamp() noexcept;
74 
75  posix::PosixUser getUser() const noexcept;
76 
77  bool isMonitored() const noexcept;
78 
79  private:
80  const uint32_t m_pid{0U};
81  runtime::IpcInterfaceUser m_ipcChannel;
82  mepoo::TimePointNs_t m_timestamp;
83  posix::PosixUser m_user;
84  bool m_isMonitored{true};
85  std::atomic<uint64_t> m_sessionId{0U};
86 };
87 
88 } // namespace roudi
89 } // namespace iox
90 
91 #endif // IOX_POSH_ROUDI_PROCESS_HPP
Definition: process.hpp:39
Process(const RuntimeName_t &name, const uint32_t pid, const posix::PosixUser &user, const bool isMonitored, const uint64_t sessionId) noexcept
This class represents an application which has registered at RouDi and manages the communication to t...
uint64_t getSessionId() noexcept
The session ID which is used to check outdated IPC channel transmissions for this process.
Process(Process &&other)=delete
Class for using a IPC channel.
Definition: ipc_interface_user.hpp:29
Definition: service_description.hpp:29