Fast DDS  Version 3.6.1.0
Fast DDS
LocatorWithMask.hpp
1 // Copyright 2022 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 
19 #ifndef FASTDDS_RTPS_COMMON__LOCATORWITHMASK_HPP
20 #define FASTDDS_RTPS_COMMON__LOCATORWITHMASK_HPP
21 
22 #include <sstream>
23 
24 #include <fastdds/fastdds_dll.hpp>
25 #include <fastdds/rtps/common/Locator.hpp>
26 
27 namespace eprosima {
28 namespace fastdds {
29 namespace rtps {
30 
34 class FASTDDS_EXPORTED_API LocatorWithMask : public Locator
35 {
36 public:
37 
43  uint8_t mask() const;
44 
50  void mask(
51  uint8_t mask);
52 
60  bool matches(
61  const Locator& loc) const;
62 
64  LocatorWithMask& operator =(
65  const Locator& loc);
66 
67 private:
68 
69  uint8_t mask_ = 24;
70 };
71 
72 FASTDDS_EXPORTED_API std::ostream& operator <<(
73  std::ostream& output,
74  const LocatorWithMask& loc);
75 
76 } // namespace rtps
77 } // namespace fastdds
78 } // namespace eprosima
79 
80 #endif // FASTDDS_RTPS_COMMON__LOCATORWITHMASK_HPP
Class Locator_t, uniquely identifies a communication channel for a particular transport.
Definition: Locator.hpp:74
A Locator with a mask that defines the number of significant bits of its address.
Definition: LocatorWithMask.hpp:35
void mask(uint8_t mask)
Set the number of significant bits on the address of this locator.
bool matches(const Locator &loc) const
Check whether the given locator is from the same network as this locator.
uint8_t mask() const
Get the number of significant bits on the address of this locator.
std::ostream & operator<<(std::ostream &output, BuiltinTransports transports)
Definition: BuiltinTransports.hpp:118