DDS-PSM-C++  1.0
ISO C++ API for OpenSplice DDS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
State.hpp
Go to the documentation of this file.
1 #ifndef OMG_DDS_CORE_STATUS_STATE_HPP_
2 #define OMG_DDS_CORE_STATUS_STATE_HPP_
3 
4 /* Copyright 2010, Object Management Group, Inc.
5  * Copyright 2010, PrismTech, Corp.
6  * Copyright 2010, Real-Time Innovations, Inc.
7  * All rights reserved.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #include <bitset>
23 #include <dds/core/macros.hpp>
24 
25 
26 namespace dds { namespace core { namespace status {
27 
28 
29  class SampleRejectedState : public std::bitset<OMG_DDS_STATE_BIT_COUNT> {
30  public:
31  typedef std::bitset<OMG_DDS_STATE_BIT_COUNT> MaskType;
32 
33  public:
35  SampleRejectedState(const SampleRejectedState& src) : MaskType(static_cast<int>(src.to_ulong())) { }
36  SampleRejectedState(const MaskType& src) : MaskType(static_cast<int>(src.to_ulong())) { }
37 
38  public:
39  inline static const SampleRejectedState not_rejected() {
40  return SampleRejectedState(0u);
41  }
43  return SampleRejectedState(0x0001 << 1u);
44  }
46  return SampleRejectedState(0x0001 << 0u);
47  }
49  return SampleRejectedState(0x0001 << 2u);
50  }
51 
52  private:
53  // @TODO
54  // -- This Ctor should be fixed as currently there is this
55  // -- cast only to avoid an error when compiling with the MS vC++ compiler
56  SampleRejectedState(uint32_t s)
57  : MaskType((uint64_t)s)
58  { }
59 
60  };
61 
62 
63  // StatusMask create_status_mask(uint64_t);
64 
65  class StatusMask : public std::bitset<OMG_DDS_STATUS_COUNT> {
66  public:
67  typedef std::bitset<OMG_DDS_STATUS_COUNT> MaskType;
68 
69  public:
70  StatusMask() { }
71  explicit StatusMask(uint64_t mask) : std::bitset<OMG_DDS_STATUS_COUNT>(mask) { }
72  StatusMask(const StatusMask& other) : MaskType(static_cast<int>(other.to_ulong())) { }
74 
75  public:
76  inline static const StatusMask all() {
77  return StatusMask(0x7fe7u);
78  }
79 
80  inline static const StatusMask none() {
81  return StatusMask(0u);
82  }
83 
84  public:
85  inline static const StatusMask inconsistent_topic() {
86  return StatusMask(0x00000001 << 0u);
87  }
88 
89  inline static const StatusMask offered_deadline_missed() {
90  return StatusMask(0x00000001 << 1u);
91  }
92 
93  inline static const StatusMask requested_deadline_missed() {
94  return StatusMask(0x00000001 << 2u);
95  }
96 
97  inline static const StatusMask offered_incompatible_qos() {
98  return StatusMask(0x00000001 << 5u);
99  }
100 
101  inline static const StatusMask requested_incompatible_qos() {
102  return StatusMask(0x00000001 << 6u);
103  }
104 
105  inline static const StatusMask sample_lost() {
106  return StatusMask(0x00000001 << 7u);
107  }
108 
109  inline static const StatusMask sample_rejected() {
110  return StatusMask(0x00000001 << 8u);
111  }
112 
113  inline static const StatusMask data_on_readers() {
114  return StatusMask(0x00000001 << 9u);
115  }
116 
117  inline static const StatusMask data_available() {
118  return StatusMask(0x00000001 << 10u);
119  }
120 
121  inline static const StatusMask liveliness_lost() {
122  return StatusMask(0x00000001 << 11u);
123  }
124 
125  inline static const StatusMask liveliness_changed() {
126  return StatusMask(0x00000001 << 12u);
127  }
128 
129  inline static const StatusMask publication_matched() {
130  return StatusMask(0x00000001 << 13u);
131  }
132 
133  inline static const StatusMask subscription_matched() {
134  return StatusMask(0x00000001 << 14u);
135  }
136 
137  };
138 
139 } } } /* namespace dds / core / status*/
140 
141 
142 #endif /* OMG_DDS_CORE_STATUS_STATE_HPP_ */