Cyclone ISO C++ API Reference Guide
DataState.hpp
Go to the documentation of this file.
1 #ifndef OMG_DDS_SUB_DATA_STATE_HPP_
2 #define OMG_DDS_SUB_DATA_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 
24 #include <dds/core/types.hpp>
25 
26 
27 namespace dds
28 {
29 namespace sub
30 {
31 namespace status
32 {
33 class SampleState;
34 class ViewState;
35 class InstanceState;
36 class DataState;
37 }
38 }
39 }
40 
57 class OMG_DDS_API dds::sub::status::SampleState : public std::bitset<OMG_DDS_STATE_BIT_COUNT>
58 {
59 public:
63  typedef std::bitset<OMG_DDS_STATE_BIT_COUNT> MaskType;
64 
65 public:
69  SampleState();
70 
76  explicit SampleState(uint32_t i);
77 
84  SampleState(const SampleState& src);
85 
91  SampleState(const MaskType& src);
92 
93 public:
104  inline static const SampleState read();
105 
114  inline static const SampleState not_read();
115 
123  inline static const SampleState any();
124 };
125 
126 
127 
146 class OMG_DDS_API dds::sub::status::ViewState : public std::bitset<OMG_DDS_STATE_BIT_COUNT>
147 {
148 public:
152  typedef std::bitset<OMG_DDS_STATE_BIT_COUNT> MaskType;
153 
154 public:
158  ViewState();
159 
165  explicit ViewState(uint32_t m);
166 
174  ViewState(const ViewState& src);
175 
181  ViewState(const MaskType& src);
182 
183 public:
195  inline static const ViewState new_view();
196 
206  inline static const ViewState not_new_view();
207 
215  inline static const ViewState any();
216 
217 };
218 
219 
220 
246 class OMG_DDS_API dds::sub::status::InstanceState : public std::bitset<OMG_DDS_STATE_BIT_COUNT>
247 {
248 public:
252  typedef std::bitset<OMG_DDS_STATE_BIT_COUNT> MaskType;
253 
254 public:
258  InstanceState();
259 
265  explicit InstanceState(uint32_t m);
266 
274  InstanceState(const InstanceState& src);
275 
281  InstanceState(const MaskType& src);
282 
283 public:
295  inline static const InstanceState alive();
296 
310  inline static const InstanceState not_alive_disposed();
311 
322  inline static const InstanceState not_alive_no_writers();
323 
342  inline static const InstanceState not_alive_mask();
343 
351  inline static const InstanceState any();
352 
353 };
354 
355 
356 
372 {
373 public:
384  : ss_(dds::sub::status::SampleState::any()),
385  vs_(dds::sub::status::ViewState::any()),
386  is_(dds::sub::status::InstanceState::any())
387  { }
388 
399  /* implicit */ DataState(const dds::sub::status::SampleState& ss)
400  : ss_(ss),
401  vs_(dds::sub::status::ViewState::any()),
402  is_(dds::sub::status::InstanceState::any())
403  { }
404 
415  /* implicit */ DataState(const dds::sub::status::ViewState& vs)
416  : ss_(dds::sub::status::SampleState::any()),
417  vs_(vs),
418  is_(dds::sub::status::InstanceState::any())
419  { }
420 
431  /* implicit */ DataState(const dds::sub::status::InstanceState& is)
432  : ss_(dds::sub::status::SampleState::any()),
433  vs_(dds::sub::status::ViewState::any()),
434  is_(is)
435  { }
436 
450  const dds::sub::status::ViewState& vs,
452  : ss_(ss), vs_(vs), is_(is)
453  { }
454 
461  {
462  ss_ = ss;
463  return *this;
464  }
465 
472  {
473  is_ = is;
474  return *this;
475  }
476 
483  {
484  vs_ = vs;
485  return *this;
486  }
487 
495  {
496  ss = ss_;
497  return *this;
498  }
499 
507  {
508  is = is_;
509  return *this;
510  }
511 
519  {
520  vs = vs_;
521  return *this;
522  }
523 
529  bool operator ==(const DataState& o) const
530  {
531  return ((ss_ == o.ss_) && (vs_ == o.vs_) && (is_ == o.is_));
532  }
533 
539  bool operator !=(const DataState& o) const
540  {
541  return !operator==(o);
542  }
543 
550  {
551  return ss_;
552  }
553 
560  {
561  *this << ss;
562  }
563 
570  {
571  return is_;
572  }
573 
580  {
581  *this << is;
582  }
583 
590  {
591  return vs_;
592  }
593 
600  {
601  *this << vs;
602  }
603 
614  static DataState any()
615  {
619  }
620 
632  {
636  }
637 
649  {
653  }
654 
666  {
670  }
671 private:
675 
676 };
677 
678 #endif /* OMG_DDS_SUB_DATA_STATE_HPP_ */
dds::sub::status::InstanceState::alive
static const InstanceState alive()
dds::sub::status::DataState::instance_state
void instance_state(const dds::sub::status::InstanceState &is)
Definition: DataState.hpp:579
dds::sub::status::SampleState::read
static const SampleState read()
dds::sub::status::DataState::DataState
DataState()
Definition: DataState.hpp:383
dds::sub::status::DataState::sample_state
const dds::sub::status::SampleState & sample_state() const
Definition: DataState.hpp:549
dds::sub::status::ViewState::new_view
static const ViewState new_view()
dds::sub::status::DataState
Class to hold sample DataState information.
Definition: DataState.hpp:371
dds::sub::status::InstanceState::InstanceState
InstanceState()
dds::sub::status::DataState::new_instance
static DataState new_instance()
Definition: DataState.hpp:665
dds::sub::status::DataState::any_data
static DataState any_data()
Definition: DataState.hpp:648
types.hpp
dds::sub::status::InstanceState
Class to hold sample InstanceState information.
Definition: DataState.hpp:246
dds::sub::status::DataState::view_state
const dds::sub::status::ViewState & view_state() const
Definition: DataState.hpp:589
dds::sub::status::InstanceState::any
static const InstanceState any()
dds::sub::status::DataState::operator!=
bool operator!=(const DataState &o) const
Definition: DataState.hpp:539
dds::sub::status::DataState::instance_state
const dds::sub::status::InstanceState & instance_state() const
Definition: DataState.hpp:569
dds::sub::status::ViewState
Class to hold sample ViewState information.
Definition: DataState.hpp:146
dds::sub::status::ViewState::MaskType
std::bitset< OMG_DDS_STATE_BIT_COUNT > MaskType
Definition: DataState.hpp:152
dds::sub::status::DataState::operator==
bool operator==(const DataState &o) const
Definition: DataState.hpp:529
dds::sub::status::DataState::DataState
DataState(const dds::sub::status::InstanceState &is)
Definition: DataState.hpp:431
OMG_DDS_API
#define OMG_DDS_API
Definition: macros.hpp:52
dds::sub::status::DataState::any
static DataState any()
Definition: DataState.hpp:614
dds::sub::status::InstanceState::MaskType
std::bitset< OMG_DDS_STATE_BIT_COUNT > MaskType
Definition: DataState.hpp:252
dds::sub::status::DataState::operator<<
DataState & operator<<(const dds::sub::status::SampleState &ss)
Definition: DataState.hpp:460
dds::sub::status::InstanceState::not_alive_mask
static const InstanceState not_alive_mask()
dds
Definition: array.hpp:30
dds::sub::status::DataState::DataState
DataState(const dds::sub::status::ViewState &vs)
Definition: DataState.hpp:415
dds::sub::status::DataState::view_state
void view_state(const dds::sub::status::ViewState &vs)
Definition: DataState.hpp:599
dds::sub::status::SampleState::SampleState
SampleState()
dds::sub::status::InstanceState::not_alive_no_writers
static const InstanceState not_alive_no_writers()
dds::sub::status::DataState::DataState
DataState(const dds::sub::status::SampleState &ss)
Definition: DataState.hpp:399
dds::sub::status::SampleState::MaskType
std::bitset< OMG_DDS_STATE_BIT_COUNT > MaskType
Definition: DataState.hpp:63
dds::sub::status::ViewState::ViewState
ViewState()
dds::sub::status::ViewState::not_new_view
static const ViewState not_new_view()
dds::sub::status::DataState::sample_state
void sample_state(const dds::sub::status::SampleState &ss)
Definition: DataState.hpp:559
dds::sub::status::ViewState::any
static const ViewState any()
dds::sub::status::SampleState::any
static const SampleState any()
dds::sub::status::DataState::new_data
static DataState new_data()
Definition: DataState.hpp:631
dds::sub::status::DataState::DataState
DataState(const dds::sub::status::SampleState &ss, const dds::sub::status::ViewState &vs, const dds::sub::status::InstanceState &is)
Definition: DataState.hpp:449
dds::sub::status::SampleState::not_read
static const SampleState not_read()
dds::sub::status::SampleState
Class to hold SampleState information.
Definition: DataState.hpp:57
dds::sub::status::InstanceState::not_alive_disposed
static const InstanceState not_alive_disposed()
dds::sub::status::DataState::operator>>
const DataState & operator>>(dds::sub::status::SampleState &ss) const
Definition: DataState.hpp:494