iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
attribute_verifier.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_ATTRIBUTE_VERIFIER_HPP
14#define IOX2_ATTRIBUTE_VERIFIER_HPP
15
16#include "attribute_error.hpp"
17#include "iox2/attribute.hpp"
19#include "iox2/bb/expected.hpp"
22
23namespace iox2 {
27 public:
33
34 auto operator=(const AttributeVerifier&) -> AttributeVerifier& = delete;
35 auto operator=(AttributeVerifier&&) noexcept -> AttributeVerifier&;
36
38 auto require(const Attribute::Key& key, const Attribute::Value& value)
39 -> bb::Expected<void, AttributeDefinitionError>;
40
42 auto require_key(const Attribute::Key& key) -> bb::Expected<void, AttributeDefinitionError>;
43
46
48 auto keys() const -> iox2::bb::StaticVector<Attribute::Key, IOX2_MAX_ATTRIBUTES_PER_SERVICE>;
49
51 auto verify_requirements(const AttributeSetView& rhs) const -> bb::Expected<void, Attribute::Key>;
52
53 private:
54 template <ServiceType>
55 friend class ServiceBuilderEvent;
56 template <typename, typename, ServiceType>
58 template <typename, typename, typename, typename, ServiceType>
60 template <typename, ServiceType>
62
63 void drop();
64
65 iox2_attribute_verifier_h m_handle = nullptr;
66};
67} // namespace iox2
68
69#endif
auto attributes() const -> AttributeSetView
Returns the underlying required [AttributeSet].
AttributeVerifier(const AttributeVerifier &)=delete
AttributeVerifier(AttributeVerifier &&) noexcept
AttributeVerifier()
Creates a new empty set of [Attribute]s.
auto require(const Attribute::Key &key, const Attribute::Value &value) -> bb::Expected< void, AttributeDefinitionError >
Requires a value for a specific key. A key is allowed to have multiple values.
auto keys() const -> iox2::bb::StaticVector< Attribute::Key, IOX2_MAX_ATTRIBUTES_PER_SERVICE >
Returns the underlying required keys.
auto require_key(const Attribute::Key &key) -> bb::Expected< void, AttributeDefinitionError >
Requires that a specific key is defined.
auto verify_requirements(const AttributeSetView &rhs) const -> bb::Expected< void, Attribute::Key >
Verifies if the [AttributeSet] contains all required keys and key-value pairs.
Builder to create new [MessagingPattern::Event] based [Service]s.
Builder to create new [MessagingPattern::PublishSubscribe] based [Service]s.
AttributeDefinitionError
Failures that can occur when defining [Attribute]s with [AttributeSpecifier::define()].