| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
StatusMask.hpp
1/*
2 * Copyright 2010, Object Management Group, Inc.
3 * Copyright 2010, PrismTech, Corp.
4 * Copyright 2010, Real-Time Innovations, Inc.
5 * Copyright 2019, Proyectos y Sistemas de Mantenimiento SL (eProsima).
6 * All rights reserved.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21#ifndef FASTDDS_DDS_CORE_STATUS__STATUSMASK_HPP
22#define FASTDDS_DDS_CORE_STATUS__STATUSMASK_HPP
23
24#include <fastdds/fastdds_dll.hpp>
25
26#include <bitset>
27#include <cstdint>
28#include <sstream>
29
31#define FASTDDS_STATUS_COUNT size_t(16)
32
33 namespace eprosima {
34 namespace fastdds {
35 namespace dds {
36
46
47 class FASTDDS_EXPORTED_API StatusMask : public std::bitset<FASTDDS_STATUS_COUNT>
48{
49 public:
50
54 typedef std::bitset<FASTDDS_STATUS_COUNT> MaskType;
55
59 StatusMask()
60 : std::bitset<FASTDDS_STATUS_COUNT>()
61 {
62 }
63
69 explicit StatusMask(
70 uint32_t mask)
71 : std::bitset<FASTDDS_STATUS_COUNT>(mask)
72 {
73 }
74
80 inline StatusMask& operator <<(
81 const StatusMask& mask)
82 {
83 *this |= mask;
84 return *this;
85 }
86
92 inline StatusMask& operator >>(
93 const StatusMask& mask)
94 {
95 *this &= ~mask;
96 return *this;
97 }
98
104 inline static StatusMask all()
105 {
106 return StatusMask(0x80007fe7u);
107 }
108
114 inline static StatusMask none()
115 {
116 return StatusMask(0u);
117 }
118
119 public:
120
126 inline static StatusMask inconsistent_topic()
127 {
128 return StatusMask(0x00000001 << 0u);
129 }
130
136 inline static StatusMask offered_deadline_missed()
137 {
138 return StatusMask(0x00000001 << 1u);
139 }
140
146 inline static StatusMask requested_deadline_missed()
147 {
148 return StatusMask(0x00000001 << 2u);
149 }
150
156 inline static StatusMask offered_incompatible_qos()
157 {
158 return StatusMask(0x00000001 << 5u);
159 }
160
166 inline static StatusMask requested_incompatible_qos()
167 {
168 return StatusMask(0x00000001 << 6u);
169 }
170
176 inline static StatusMask sample_lost()
177 {
178 return StatusMask(0x00000001 << 7u);
179 }
180
186 inline static StatusMask sample_rejected()
187 {
188 return StatusMask(0x00000001 << 8u);
189 }
190
196 inline static StatusMask data_on_readers()
197 {
198 return StatusMask(0x00000001 << 9u);
199 }
200
206 inline static StatusMask data_available()
207 {
208 return StatusMask(0x00000001 << 10u);
209 }
210
216 inline static StatusMask liveliness_lost()
217 {
218 return StatusMask(0x00000001 << 11u);
219 }
220
226 inline static StatusMask liveliness_changed()
227 {
228 return StatusMask(0x00000001 << 12u);
229 }
230
236 inline static StatusMask publication_matched()
237 {
238 return StatusMask(0x00000001 << 13u);
239 }
240
246 inline static StatusMask subscription_matched()
247 {
248 return StatusMask(0x00000001 << 14u);
249 }
250
256 bool is_active(
257 StatusMask status) const
258 {
259 MaskType r = *this & status;
260 return r == status;
261 }
262
263};
264
265} //namespace dds
266} //namespace fastdds
267} //namespace eprosima
268
269
270#endif //FASTDDS_DDS_CORE_STATUS__STATUSMASK_HPP
eprosima::fastdds::dds::StatusMask::subscription_matched
static StatusMask subscription_matched()
Get the statusmask associated with dds::core::status::SubscriptionMatchedStatus.
Definition StatusMask.hpp:246
eprosima::fastdds::dds::StatusMask::requested_incompatible_qos
static StatusMask requested_incompatible_qos()
Get the StatusMask associated with dds::core::status::RequestedIncompatibleQosStatus.
Definition StatusMask.hpp:166
eprosima::fastdds::dds::StatusMask::inconsistent_topic
static StatusMask inconsistent_topic()
Get the StatusMask associated with dds::core::status::InconsistentTopicStatus.
Definition StatusMask.hpp:126
eprosima::fastdds::dds::StatusMask::MaskType
std::bitset< FASTDDS_STATUS_COUNT > MaskType
Convenience typedef for std::bitset<FASTDDS_STATUS_COUNT>.
Definition StatusMask.hpp:54
eprosima::fastdds::dds::StatusMask::sample_lost
static StatusMask sample_lost()
Get the StatusMask associated with dds::core::status::SampleLostStatus.
Definition StatusMask.hpp:176
eprosima::fastdds::dds::StatusMask::none
static StatusMask none()
Get no StatusMasks.
Definition StatusMask.hpp:114
eprosima::fastdds::dds::StatusMask::is_active
bool is_active(StatusMask status) const
Checks if the status passed as parameter is 1 in the actual StatusMask.
Definition StatusMask.hpp:256
eprosima::fastdds::dds::StatusMask::all
static StatusMask all()
Get all StatusMasks.
Definition StatusMask.hpp:104
eprosima::fastdds::dds::StatusMask::sample_rejected
static StatusMask sample_rejected()
Get the StatusMask associated with dds::core::status::SampleRejectedStatus.
Definition StatusMask.hpp:186
eprosima::fastdds::dds::StatusMask::offered_deadline_missed
static StatusMask offered_deadline_missed()
Get the StatusMask associated with dds::core::status::OfferedDeadlineMissedStatus.
Definition StatusMask.hpp:136
eprosima::fastdds::dds::StatusMask::liveliness_changed
static StatusMask liveliness_changed()
Get the StatusMask associated with dds::core::status::LivelinessChangedStatus.
Definition StatusMask.hpp:226
eprosima::fastdds::dds::StatusMask::data_on_readers
static StatusMask data_on_readers()
Get the StatusMask associated with dds::core::status::data_on_readers.
Definition StatusMask.hpp:196
eprosima::fastdds::dds::StatusMask::StatusMask
StatusMask(uint32_t mask)
Construct an StatusMask with an uint32_t bit mask.
Definition StatusMask.hpp:69
eprosima::fastdds::dds::StatusMask::liveliness_lost
static StatusMask liveliness_lost()
Get the StatusMask associated with dds::core::status::LivelinessLostStatus.
Definition StatusMask.hpp:216
eprosima::fastdds::dds::StatusMask::StatusMask
StatusMask()
Construct an StatusMask with no flags set.
Definition StatusMask.hpp:59
eprosima::fastdds::dds::StatusMask::publication_matched
static StatusMask publication_matched()
Get the statusmask associated with dds::core::status::PublicationMatchedStatus.
Definition StatusMask.hpp:236
eprosima::fastdds::dds::StatusMask::data_available
static StatusMask data_available()
get the statusmask associated with dds::core::status::data_available
Definition StatusMask.hpp:206
eprosima::fastdds::dds::StatusMask::requested_deadline_missed
static StatusMask requested_deadline_missed()
Get the StatusMask associated with dds::core::status::RequestedDeadlineMissedStatus.
Definition StatusMask.hpp:146
eprosima::fastdds::dds::StatusMask::offered_incompatible_qos
static StatusMask offered_incompatible_qos()
Get the StatusMask associated with dds::core::status::OfferedIncompatibleQosStatus.
Definition StatusMask.hpp:156
eprosima::fastdds::dds
Definition BuiltinTopicKey.hpp:26
eprosima::fastdds
eprosima
eProsima namespace.
std
Definition EntityId_t.hpp:388