| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
LocatorListComparisons.hpp
1// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
18
19#ifndef FASTDDS_RTPS_COMMON__LOCATORLISTCOMPARISONS_HPP
20#define FASTDDS_RTPS_COMMON__LOCATORLISTCOMPARISONS_HPP
21
22#include <fastdds/rtps/common/Locator.hpp>
23#include <fastdds/utils/collections/ResourceLimitedVector.hpp>
24#include <algorithm>
25
26 namespace eprosima {
27 namespace fastdds {
28 namespace rtps {
29
38 static inline bool operator == (
39 const ResourceLimitedVector<Locator_t>& lhs,
40 const ResourceLimitedVector<Locator_t>& rhs)
41{
42 if (lhs.size() == rhs.size())
43 {
44 for (const Locator_t& locator : lhs)
45 {
46 if (std::find(rhs.begin(), rhs.end(), locator) == rhs.end())
47 {
48 return false;
49 }
50 }
51
52 return true;
53 }
54
55 return false;
56}
57
58} // namespace rtps
59} // namespace fastdds
60} // namespace eprosima
61
62#endif // FASTDDS_RTPS_COMMON__LOCATORLISTCOMPARISONS_HPP
eprosima::fastdds::ResourceLimitedVector
Resource limited wrapper of std::vector.
Definition ResourceLimitedVector.hpp:59
eprosima::fastdds::ResourceLimitedVector::size
size_type size() const noexcept
Definition ResourceLimitedVector.hpp:479
eprosima::fastdds::ResourceLimitedVector::begin
iterator begin() noexcept
Definition ResourceLimitedVector.hpp:414
eprosima::fastdds::ResourceLimitedVector::end
iterator end() noexcept
Definition ResourceLimitedVector.hpp:429
eprosima::fastdds::rtps::Locator_t
Class Locator_t, uniquely identifies a communication channel for a particular transport.
Definition Locator.hpp:71
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds::rtps::operator==
bool operator==(const BuiltinTransportsOptions &bto1, const BuiltinTransportsOptions &bto2)
Equal to operator.
Definition BuiltinTransports.hpp:79
eprosima::fastdds
eprosima
eProsima namespace.