/src/Fast-DDS/include/fastdds/rtps/common/LocatorWithMask.hpp
Line | Count | Source (jump to first uncovered line) |
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 | | |
15 | | /** |
16 | | * @file LocatorWithMask.hpp |
17 | | */ |
18 | | |
19 | | #ifndef _FASTDDS_RTPS_COMMON_LOCATORWITHMASK_HPP_ |
20 | | #define _FASTDDS_RTPS_COMMON_LOCATORWITHMASK_HPP_ |
21 | | |
22 | | #include <fastrtps/fastrtps_dll.h> |
23 | | |
24 | | #include <fastdds/rtps/common/Locator.h> |
25 | | |
26 | | namespace eprosima { |
27 | | namespace fastdds { |
28 | | namespace rtps { |
29 | | |
30 | | /** |
31 | | * A Locator with a mask that defines the number of significant bits of its address. |
32 | | */ |
33 | | class RTPS_DllAPI LocatorWithMask : public Locator |
34 | | { |
35 | | public: |
36 | | |
37 | | /** |
38 | | * Get the number of significant bits on the address of this locator. |
39 | | * |
40 | | * @return number of significant bits on the address of this locator. |
41 | | */ |
42 | | uint8_t mask() const |
43 | 0 | { |
44 | 0 | return mask_; |
45 | 0 | } |
46 | | |
47 | | /** |
48 | | * Set the number of significant bits on the address of this locator. |
49 | | * |
50 | | * @param mask number of significant bits on the address of this locator. |
51 | | */ |
52 | | void mask( |
53 | | uint8_t mask) |
54 | 0 | { |
55 | 0 | mask_ = mask; |
56 | 0 | } |
57 | | |
58 | | private: |
59 | | |
60 | | uint8_t mask_ = 24; |
61 | | }; |
62 | | |
63 | | } // namespace rtps |
64 | | } // namespace fastdds |
65 | | } // namespace eprosima |
66 | | |
67 | | #endif /* _FASTDDS_RTPS_COMMON_LOCATORWITHMASK_HPP_ */ |