OpenDDS::DCPS::SequenceNumber Class Reference

Sequence number abstraction. Only allows positive 64 bit values. More...

#include <Definitions.h>

Collaboration diagram for OpenDDS::DCPS::SequenceNumber:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_INT64 Value

Public Member Functions

 SequenceNumber (Value value=MIN_VALUE)
 Construct with a value, default to one (starting point).
SequenceNumberoperator++ ()
 Pre-increment.
SequenceNumber operator++ (int)
 Post-increment.
SequenceNumber previous () const
void setValue (Value value)
void setValue (ACE_INT32 high, ACE_UINT32 low)
Value getValue () const
bool operator< (const SequenceNumber &rvalue) const
bool operator== (const SequenceNumber &rvalue) const
 Derive a full suite of logical operations.
bool operator!= (const SequenceNumber &rvalue) const
bool operator>= (const SequenceNumber &rvalue) const
bool operator<= (const SequenceNumber &rvalue) const
bool operator> (const SequenceNumber &rvalue) const
ACE_INT32 getHigh () const
ACE_UINT32 getLow () const

Static Public Member Functions

static SequenceNumber SEQUENCENUMBER_UNKNOWN ()
static SequenceNumber ZERO ()

Static Public Attributes

static const Value MAX_VALUE = ACE_INT64_MAX
static const Value MIN_VALUE = 1
static const Value LOW_BASE = 0x0000000100000000LL

Private Member Functions

 SequenceNumber (ACE_INT32 high, ACE_UINT32 low)

Private Attributes

ACE_INT32 high_
ACE_UINT32 low_

Friends

ACE_CDR::Boolean operator>> (Serializer &s, SequenceNumber &x)

Detailed Description

Sequence number abstraction. Only allows positive 64 bit values.

Definition at line 52 of file Definitions.h.


Member Typedef Documentation

typedef ACE_INT64 OpenDDS::DCPS::SequenceNumber::Value

Definition at line 54 of file Definitions.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::SequenceNumber::SequenceNumber ( Value  value = MIN_VALUE  )  [inline]

Construct with a value, default to one (starting point).

Definition at line 56 of file Definitions.h.

00056                                           {
00057     setValue(value);
00058   }

OpenDDS::DCPS::SequenceNumber::SequenceNumber ( ACE_INT32  high,
ACE_UINT32  low 
) [inline, private]

Definition at line 172 of file Definitions.h.

00173     : high_(high), low_(low) {
00174   }


Member Function Documentation

ACE_INT32 OpenDDS::DCPS::SequenceNumber::getHigh (  )  const [inline]

Definition at line 146 of file Definitions.h.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::add_gap_submsg(), OpenDDS::RTPS::Spdp::SpdpTransport::dispose_unregister(), OpenDDS::DCPS::RtpsUdpDataLink::marshal_gaps(), OpenDDS::DCPS::operator<<(), OpenDDS::DCPS::RtpsSampleHeader::populate_data_sample_submessages(), OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats(), OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats_manual(), and OpenDDS::RTPS::Spdp::SpdpTransport::write_i().

00146                             {
00147     return high_;
00148   }

ACE_UINT32 OpenDDS::DCPS::SequenceNumber::getLow (  )  const [inline]

Definition at line 149 of file Definitions.h.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::add_gap_submsg(), OpenDDS::RTPS::Spdp::SpdpTransport::dispose_unregister(), OpenDDS::DCPS::TransportReassembly::get_gaps(), OpenDDS::DCPS::RtpsUdpDataLink::marshal_gaps(), OpenDDS::DCPS::operator<<(), OpenDDS::DCPS::RtpsSampleHeader::populate_data_sample_submessages(), OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats(), OpenDDS::DCPS::RtpsUdpDataLink::send_heartbeats_manual(), and OpenDDS::RTPS::Spdp::SpdpTransport::write_i().

00149                             {
00150     return low_;
00151   }

Value OpenDDS::DCPS::SequenceNumber::getValue (  )  const [inline]

Definition at line 117 of file Definitions.h.

Referenced by bitmap_num_longs(), OpenDDS::DCPS::WriteDataContainer::data_delivered(), OpenDDS::DCPS::RtpsUdpReceiveStrategy::deliver_sample(), OpenDDS::DCPS::ReliableSession::expire_naks(), OpenDDS::DCPS::SingleSendBuffer::insert(), OpenDDS::DCPS::RtpsUdpDataLink::MultiSendBuffer::insert(), OpenDDS::DCPS::DisjointSequence::insert(), OpenDDS::DCPS::SingleSendBuffer::insert_fragment(), OpenDDS::DCPS::ReliableSession::nak_received(), OpenDDS::DCPS::operator+(), OpenDDS::DCPS::operator+=(), OpenDDS::DCPS::operator<<(), OpenDDS::DCPS::RtpsUdpDataLink::process_data_i(), OpenDDS::DCPS::RtpsUdpDataLink::process_heartbeat_i(), OpenDDS::DCPS::ReliableSession::ready_to_deliver(), OpenDDS::DCPS::TransportReassembly::reassemble_i(), OpenDDS::DCPS::InstanceState::sample_info(), OpenDDS::DCPS::DataReaderImpl::sample_info(), OpenDDS::DCPS::RtpsUdpDataLink::send_ack_nacks(), OpenDDS::DCPS::ReliableSession::send_nakack(), OpenDDS::DCPS::ReliableSession::send_naks(), OpenDDS::DCPS::WriteDataContainer::sequence_acknowledged(), OpenDDS::DCPS::DisjointSequence::to_bitmap(), OpenDDS::DCPS::to_string(), OpenDDS::DCPS::WriteDataContainer::wait_ack_of_seq(), and OpenDDS::DCPS::DataWriterImpl::wait_for_acknowledgments().

00117                          {
00118     return LOW_BASE * this->high_ + this->low_;
00119   }

bool OpenDDS::DCPS::SequenceNumber::operator!= ( const SequenceNumber rvalue  )  const [inline]

Definition at line 131 of file Definitions.h.

References high_, and low_.

00131                                                       {
00132     return (this->high_ != rvalue.high_) ||
00133            (this->low_ != rvalue.low_) ;
00134   }

SequenceNumber OpenDDS::DCPS::SequenceNumber::operator++ ( int   )  [inline]

Post-increment.

Definition at line 79 of file Definitions.h.

00079                                  {
00080     SequenceNumber value(*this);
00081     ++*this;
00082     return value ;
00083   }

SequenceNumber& OpenDDS::DCPS::SequenceNumber::operator++ (  )  [inline]

Pre-increment.

Definition at line 61 of file Definitions.h.

00061                                {
00062     if (this->low_ == ACE_UINT32_MAX) {
00063       if (this->high_ == ACE_INT32_MAX) {
00064         // this code is here, despite the RTPS spec statement:
00065         // "sequence numbers never wrap"
00066         this->high_ = 0;
00067         this->low_ = 1;
00068       } else {
00069         ++this->high_;
00070         this->low_ = 0;
00071       }
00072     } else {
00073       ++this->low_;
00074     }
00075     return *this ;
00076   }

bool OpenDDS::DCPS::SequenceNumber::operator< ( const SequenceNumber rvalue  )  const [inline]

Definition at line 121 of file Definitions.h.

References high_, and low_.

00121                                                      {
00122     return (this->high_ < rvalue.high_)
00123       || (this->high_ == rvalue.high_ && this->low_ < rvalue.low_);
00124   }

bool OpenDDS::DCPS::SequenceNumber::operator<= ( const SequenceNumber rvalue  )  const [inline]

Definition at line 138 of file Definitions.h.

00138                                                       {
00139     return !(rvalue < *this);
00140   }

bool OpenDDS::DCPS::SequenceNumber::operator== ( const SequenceNumber rvalue  )  const [inline]

Derive a full suite of logical operations.

Definition at line 127 of file Definitions.h.

References high_, and low_.

00127                                                       {
00128     return (this->high_ == rvalue.high_) &&
00129            (this->low_ == rvalue.low_) ;
00130   }

bool OpenDDS::DCPS::SequenceNumber::operator> ( const SequenceNumber rvalue  )  const [inline]

Definition at line 141 of file Definitions.h.

00141                                                      {
00142     return (rvalue < *this)
00143            && (*this != rvalue);
00144   }

bool OpenDDS::DCPS::SequenceNumber::operator>= ( const SequenceNumber rvalue  )  const [inline]

Definition at line 135 of file Definitions.h.

00135                                                       {
00136     return !(*this  < rvalue);
00137   }

SequenceNumber OpenDDS::DCPS::SequenceNumber::previous (  )  const [inline]

Definition at line 85 of file Definitions.h.

References high_, and low_.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::marshal_gaps(), OpenDDS::DCPS::RtpsUdpDataLink::process_data_i(), OpenDDS::DCPS::RtpsUdpDataLink::process_gap_i(), OpenDDS::DCPS::RtpsUdpDataLink::process_heartbeat_i(), OpenDDS::DCPS::BestEffortSession::ready_to_deliver(), OpenDDS::DCPS::RtpsUdpDataLink::received(), and OpenDDS::DCPS::RtpsUdpDataLink::send_ack_nacks().

00085                                   {
00086     SequenceNumber retVal(*this);
00087     if ((this->low_ == 1) && (this->high_ == 0)) {
00088       retVal.high_ = ACE_INT32_MAX;
00089       retVal.low_  = ACE_UINT32_MAX;
00090       return retVal;
00091     }
00092     if (this->low_ == 0) {
00093       --retVal.high_;
00094       retVal.low_ = ACE_UINT32_MAX;
00095     } else {
00096       --retVal.low_;
00097     }
00098     return retVal ;
00099   }

static SequenceNumber OpenDDS::DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN (  )  [inline, static]

Definition at line 154 of file Definitions.h.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::add_gap_submsg(), OpenDDS::DCPS::UdpReceiveStrategy::check_header(), OpenDDS::DCPS::BestEffortSession::check_header(), OpenDDS::DCPS::DataReaderImpl::check_historic(), OpenDDS::DCPS::DataWriterImpl::create_control_message(), OpenDDS::DCPS::ReplayerImpl::create_sample_data_message(), OpenDDS::DCPS::DataWriterImpl::create_sample_data_message(), OpenDDS::DCPS::WriteDataContainer::data_delivered(), OpenDDS::RTPS::Sedp::Writer::end_historic_samples(), OpenDDS::DCPS::RtpsUdpDataLink::MultiSendBuffer::insert(), OpenDDS::DCPS::BestEffortSession::ready_to_deliver(), OpenDDS::DCPS::RtpsUdpDataLink::received(), OpenDDS::DCPS::RtpsCustomizedElement::sequence(), OpenDDS::DCPS::WriteDataContainer::sequence_acknowledged(), OpenDDS::RTPS::Sedp::Writer::set_header_fields(), and OpenDDS::DCPS::RtpsSampleHeader::split().

00154                                                  {
00155     return SequenceNumber(-1, 0);
00156   }

void OpenDDS::DCPS::SequenceNumber::setValue ( ACE_INT32  high,
ACE_UINT32  low 
) [inline]

Definition at line 109 of file Definitions.h.

00109                                                 {
00110     this->high_ = high;
00111     this->low_ = low;
00112     if (this->getValue() < MIN_VALUE) {
00113       this->setValue(MIN_VALUE);
00114     }
00115   }

void OpenDDS::DCPS::SequenceNumber::setValue ( Value  value  )  [inline]

Definition at line 101 of file Definitions.h.

Referenced by OpenDDS::DCPS::RtpsSampleHeader::into_received_data_sample(), OpenDDS::DCPS::RtpsUdpDataLink::marshal_gaps(), OpenDDS::DCPS::operator+=(), OpenDDS::DCPS::RtpsUdpDataLink::process_data_i(), OpenDDS::DCPS::RtpsUdpDataLink::process_gap_i(), OpenDDS::DCPS::RtpsUdpDataLink::process_hb_frag_i(), OpenDDS::DCPS::RtpsUdpDataLink::process_heartbeat_i(), OpenDDS::DCPS::RtpsUdpDataLink::received(), and OpenDDS::DCPS::RtpsUdpDataLink::send_nack_replies().

00101                              {
00102     if (value < MIN_VALUE) {
00103       value = MIN_VALUE;
00104     }
00105     this->high_ = ACE_INT32(value / LOW_BASE);
00106     this->low_  = ACE_UINT32(value % LOW_BASE);
00107   }

static SequenceNumber OpenDDS::DCPS::SequenceNumber::ZERO (  )  [inline, static]

Definition at line 158 of file Definitions.h.

Referenced by OpenDDS::DCPS::DisjointSequence::insert_i(), OpenDDS::DCPS::RtpsUdpDataLink::process_heartbeat_i(), OpenDDS::DCPS::RtpsUdpDataLink::received(), OpenDDS::DCPS::SingleSendBuffer::resend_fragments_i(), and OpenDDS::DCPS::RtpsUdpDataLink::send_ack_nacks().

00158                                {
00159     return SequenceNumber(0, 0);
00160   }


Friends And Related Function Documentation

ACE_CDR::Boolean operator>> ( Serializer s,
SequenceNumber x 
) [friend]

Definition at line 188 of file Definitions.h.

00188                                              {
00189   ACE_INT32 high;
00190   ACE_UINT32 low;
00191   s >> high;
00192   if (!s.good_bit()) return false;
00193   s >> low;
00194   if (!s.good_bit()) return false;
00195   x = SequenceNumber(high, low);
00196   return true;
00197 }


Member Data Documentation

ACE_INT32 OpenDDS::DCPS::SequenceNumber::high_ [private]

Definition at line 176 of file Definitions.h.

Referenced by operator!=(), operator<(), operator==(), and previous().

ACE_UINT32 OpenDDS::DCPS::SequenceNumber::low_ [private]

Definition at line 177 of file Definitions.h.

Referenced by operator!=(), operator<(), operator==(), and previous().

const Value OpenDDS::DCPS::SequenceNumber::LOW_BASE = 0x0000000100000000LL [static]

Definition at line 164 of file Definitions.h.

const Value OpenDDS::DCPS::SequenceNumber::MAX_VALUE = ACE_INT64_MAX [static]

Definition at line 162 of file Definitions.h.

Referenced by OpenDDS::DCPS::RtpsUdpDataLink::process_acked_by_all_i(), and OpenDDS::DCPS::RtpsUdpDataLink::send_nack_replies().

const Value OpenDDS::DCPS::SequenceNumber::MIN_VALUE = 1 [static]

Definition at line 163 of file Definitions.h.


The documentation for this class was generated from the following file:
Generated on Fri Feb 12 20:06:14 2016 for OpenDDS by  doxygen 1.4.7