iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
service_name.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_SERVICE_NAME_HPP
14#define IOX2_SERVICE_NAME_HPP
15
16#include "iox2/bb/expected.hpp"
19
20namespace iox2 {
21class ServiceName;
22
25 public:
29 auto operator=(const ServiceNameView&) -> ServiceNameView& = default;
30 ~ServiceNameView() = default;
31
33 auto to_string() const -> iox2::bb::StaticString<IOX2_SERVICE_NAME_LENGTH>;
34
36 auto to_owned() const -> ServiceName;
37
38 private:
39 friend class ServiceName;
40 template <ServiceType>
41 friend class Service;
42 template <ServiceType>
43 friend class Node;
44 template <ServiceType>
45 friend class PortFactoryEvent;
46 template <ServiceType, typename, typename>
48 template <ServiceType, typename, typename, typename, typename>
50 template <ServiceType, typename>
52
53 explicit ServiceNameView(iox2_service_name_ptr ptr);
54 iox2_service_name_ptr m_ptr = nullptr;
55};
56
59 public:
61 auto operator=(ServiceName&&) noexcept -> ServiceName&;
63 auto operator=(const ServiceName&) -> ServiceName&;
65
67 auto as_view() const -> ServiceNameView;
68
70 static auto create(const char* value) -> iox2::bb::Expected<ServiceName, bb::SemanticStringError>;
71
73 auto to_string() const -> iox2::bb::StaticString<IOX2_SERVICE_NAME_LENGTH>;
74
75 private:
76 friend class ServiceNameView;
77 explicit ServiceName(iox2_service_name_h handle);
78 static auto create_impl(const char* value, size_t value_len)
79 -> iox2::bb::Expected<ServiceName, bb::SemanticStringError>;
80 void drop() noexcept;
81
82 iox2_service_name_h m_handle = nullptr;
83};
84} // namespace iox2
85
86#endif
Represents the port factory of a [Service] with [MessagingPattern::Blackboard].
Represents the port factory of a [Service] with [MessagingPattern::Event].
Non-owning view of a [ServiceName].
auto operator=(const ServiceNameView &) -> ServiceNameView &=default
ServiceNameView(const ServiceNameView &)=default
ServiceNameView(ServiceNameView &&)=default
auto operator=(ServiceNameView &&) -> ServiceNameView &=default
auto to_owned() const -> ServiceName
Creates a copy of the corresponding [ServiceName] and returns it.
~ServiceNameView()=default
auto to_string() const -> iox2::bb::StaticString< IOX2_SERVICE_NAME_LENGTH >
Returns a [iox2::bb::StaticString] containing the [ServiceName].
The name of a [Service].
ServiceName(ServiceName &&) noexcept