00001 #ifndef OMG_DDS_CORE_STATUS_STATE_HPP_ 00002 #define OMG_DDS_CORE_STATUS_STATE_HPP_ 00003 00004 /* Copyright 2010, Object Management Group, Inc. 00005 * Copyright 2010, PrismTech, Corp. 00006 * Copyright 2010, Real-Time Innovations, Inc. 00007 * All rights reserved. 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); 00010 * you may not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, 00017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 #include <bitset> 00023 00024 #include <dds/core/corefwd.hpp> 00025 #include <dds/core/macros.hpp> 00026 00027 00028 namespace dds { namespace core { namespace status { 00029 00030 00031 class SampleRejectedState : public std::bitset<OMG_DDS_STATE_BIT_COUNT> { 00032 public: 00033 typedef std::bitset<OMG_DDS_STATE_BIT_COUNT> MaskType; 00034 00035 public: 00036 SampleRejectedState() : MaskType() { } 00037 SampleRejectedState(const SampleRejectedState& src) : MaskType(src) { } 00038 SampleRejectedState(const MaskType& src) : MaskType(src) { } 00039 00040 public: 00041 inline static const SampleRejectedState not_rejected() { 00042 return SampleRejectedState(0u); 00043 } 00044 inline static const SampleRejectedState rejected_by_samples_limit() { 00045 return SampleRejectedState(0x0001 << 1u); 00046 } 00047 inline static const SampleRejectedState rejected_by_instances_limit() { 00048 return SampleRejectedState(0x0001 << 0u); 00049 } 00050 inline static const SampleRejectedState rejected_by_samples_per_instance_limit() { 00051 return SampleRejectedState(0x0001 << 2u); 00052 } 00053 00054 private: 00055 SampleRejectedState(uint32_t s) : MaskType(s) { } 00056 00057 }; 00058 00059 00060 StatusMask create_status_mask(uint64_t); 00061 00062 class StatusMask : public std::bitset<OMG_DDS_STATUS_COUNT> { 00063 public: 00064 typedef std::bitset<OMG_DDS_STATUS_COUNT> MaskType; 00065 00066 public: 00067 StatusMask() { } 00068 StatusMask(const StatusMask& other) : MaskType(other) { } 00069 ~StatusMask() { } 00070 00071 public: 00072 inline static const StatusMask all() { 00073 return StatusMask(~0u); 00074 } 00075 00076 inline static const StatusMask none() { 00077 return StatusMask(0u); 00078 } 00079 00080 public: 00081 inline static const StatusMask inconsistent_topic() { 00082 return StatusMask(0x00000001 < 0u); 00083 } 00084 00085 inline static const StatusMask offered_deadline_missed() { 00086 return StatusMask(0x00000001 < 1u); 00087 } 00088 00089 inline static const StatusMask requested_deadline_missed() { 00090 return StatusMask(0x00000001 < 2u); 00091 } 00092 00093 inline static const StatusMask offered_incompatible_qos() { 00094 return StatusMask(0x00000001 < 5u); 00095 } 00096 00097 inline static const StatusMask requested_incompatible_qos() { 00098 return StatusMask(0x00000001 < 6u); 00099 } 00100 00101 inline static const StatusMask sample_lost() { 00102 return StatusMask(0x00000001 < 7u); 00103 } 00104 00105 inline static const StatusMask sample_rejected() { 00106 return StatusMask(0x00000001 < 8u); 00107 } 00108 00109 inline static const StatusMask data_on_readers() { 00110 return StatusMask(0x00000001 < 9u); 00111 } 00112 00113 inline static const StatusMask data_available() { 00114 return StatusMask(0x00000001 < 10u); 00115 } 00116 00117 inline static const StatusMask liveliness_lost() { 00118 return StatusMask(0x00000001 < 11u); 00119 } 00120 00121 inline static const StatusMask liveliness_changed() { 00122 return StatusMask(0x00000001 < 12u); 00123 } 00124 00125 inline static const StatusMask publication_matched() { 00126 return StatusMask(0x00000001 < 13u); 00127 } 00128 00129 inline static const StatusMask subscription_matched() { 00130 return StatusMask(0x00000001 < 14u); 00131 } 00132 00133 private: 00134 StatusMask(uint64_t mask) : MaskType(mask) { } 00135 friend StatusMask dds::core::status::create_status_mask(uint64_t s); 00136 00137 }; 00138 00139 } } } /* namespace dds / core / status*/ 00140 00141 00142 #endif /* OMG_DDS_CORE_STATUS_STATE_HPP_ */
1.7.1