iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
file_descriptor.hpp
Go to the documentation of this file.
1// Copyright (c) 2024 Contributors to the Eclipse Foundation
2//
3// See the NOTICE file(s) distributed with this work for additional
4// information regarding copyright ownership.
5//
6// This program and the accompanying materials are made available under the
7// terms of the Apache Software License 2.0 which is available at
8// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
9// which is available at https://opensource.org/licenses/MIT.
10//
11// SPDX-License-Identifier: Apache-2.0 OR MIT
12
13#ifndef IOX2_FILE_DESCRIPTOR_HPP
14#define IOX2_FILE_DESCRIPTOR_HPP
15
16#include "iox2/bb/optional.hpp"
18
19namespace iox2 {
20class FileDescriptorView;
21
35
38 public:
40 auto file_descriptor() const -> FileDescriptorView override;
41
50 auto unsafe_native_handle() const -> int32_t;
51
52 private:
53 template <ServiceType>
54 friend class WaitSet;
55 friend class FileDescriptor;
56 template <ServiceType>
57 friend class Listener;
58
59 explicit FileDescriptorView(iox2_file_descriptor_ptr handle);
60
61 iox2_file_descriptor_ptr m_handle = nullptr;
62};
63
67 public:
71
75
77 auto operator=(const FileDescriptor&) -> FileDescriptor& = delete;
78
80 auto operator=(FileDescriptor&& rhs) noexcept -> FileDescriptor&;
82
91 auto unsafe_native_handle() const -> int32_t;
92
95 auto as_view() const -> FileDescriptorView;
96
97 private:
98 explicit FileDescriptor(iox2_file_descriptor_h handle);
99 void drop();
100
101 iox2_file_descriptor_h m_handle = nullptr;
102};
103
104} // namespace iox2
105
106#endif
Abstract class that can be implemented by a class that is based on a [FileDescriptor].
FileDescriptorBased(const FileDescriptorBased &)=default
virtual ~FileDescriptorBased()=default
auto operator=(const FileDescriptorBased &) -> FileDescriptorBased &=default
FileDescriptorBased(FileDescriptorBased &&)=default
auto operator=(FileDescriptorBased &&) -> FileDescriptorBased &=default
virtual auto file_descriptor() const -> FileDescriptorView=0
Returns a [FileDescriptorView] to the underlying [FileDescriptor].
A view to a [FileDescriptor].
auto file_descriptor() const -> FileDescriptorView override
Returns a [FileDescriptorView] to the underlying [FileDescriptor].
static auto create_non_owning(int32_t file_descriptor) -> bb::Optional< FileDescriptor >
static auto create_owning(int32_t file_descriptor) -> bb::Optional< FileDescriptor >
auto operator=(FileDescriptor &&rhs) noexcept -> FileDescriptor &
auto operator=(const FileDescriptor &) -> FileDescriptor &=delete
FileDescriptor(const FileDescriptor &)=delete
auto unsafe_native_handle() const -> int32_t
FileDescriptor(FileDescriptor &&rhs) noexcept
Represents the receiving endpoint of an event based communication.
Definition listener.hpp:32
iox2::bb::variation::Optional< T > Optional
Definition optional.hpp:25