OpenDDS
Snapshot(2023/04/07-19:43)
|
#include <DisjointSequence.h>
Classes | |
class | OrderedRanges |
Public Member Functions | |
DisjointSequence () | |
void | reset () |
bool | empty () const |
SequenceNumber | low () const |
SequenceNumber | high () const |
SequenceNumber | cumulative_ack () const |
SequenceNumber | last_ack () const |
bool | disjoint () const |
bool | contains (SequenceNumber value) const |
bool | contains_any (const SequenceRange &range) const |
bool | insert (const SequenceRange &range, OPENDDS_VECTOR(SequenceRange)&added) |
bool | insert (const SequenceRange &range) |
Insert all numbers between range.first and range.second (both inclusive). More... | |
bool | insert (SequenceNumber value) |
Shorthand for "insert(SequenceRange(value, value))". More... | |
void | erase (SequenceNumber value) |
bool | insert (SequenceNumber value, ACE_CDR::ULong num_bits, const ACE_CDR::Long bits[]) |
bool | insert_filtered (const SequenceRange &range, const DisjointSequence &filter) |
Insert the intersection of range and filter. More... | |
bool | to_bitmap (ACE_CDR::Long bitmap[], ACE_CDR::ULong length, ACE_CDR::ULong &num_bits, ACE_CDR::ULong &cumulative_bits_added, bool invert=false) const |
OPENDDS_VECTOR (SequenceRange) missing_sequence_ranges() const | |
Returns missing ranges of SequenceNumbers (internal gaps in the sequence) More... | |
OPENDDS_VECTOR (SequenceRange) present_sequence_ranges() const | |
void | dump () const |
Static Public Member Functions | |
static bool | fill_bitmap_range (ACE_CDR::ULong low, ACE_CDR::ULong high, ACE_CDR::Long bitmap[], ACE_CDR::ULong length, ACE_CDR::ULong &num_bits, ACE_CDR::ULong &cumulative_bits_added) |
Set the bits in range [low, high] in the bitmap, updating num_bits. More... | |
static ACE_CDR::ULong | bitmap_num_longs (const SequenceNumber &low, const SequenceNumber &high) |
Private Types | |
typedef OrderedRanges< SequenceNumber > | RangeSet |
Private Member Functions | |
bool | insert_i (const SequenceRange &range, OPENDDS_VECTOR(SequenceRange) *gaps=0) |
bool | insert_bitmap_range (RangeSet::Container::iterator &iter, const SequenceRange &sr) |
Private Attributes | |
RangeSet | sequences_ |
Data structure for a set of SequenceNumbers. Sequence numbers can be inserted as single numbers, ranges, or RTPS-style bitmaps. The DisjointSequence can then be queried for contiguous ranges and internal gaps.
Definition at line 23 of file DisjointSequence.h.
|
private |
Definition at line 274 of file DisjointSequence.h.
ACE_INLINE OpenDDS::DCPS::DisjointSequence::DisjointSequence | ( | ) |
|
static |
Return the number of CORBA::Longs required for the bitmap representation of sequence numbers between low and high, inclusive (maximum 8 longs).
Definition at line 331 of file DisjointSequence.cpp.
References OpenDDS::DCPS::SequenceNumber::getValue().
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::gather_ack_nacks_i(), and OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_gaps_i().
bool OpenDDS::DCPS::DisjointSequence::contains | ( | SequenceNumber | value | ) | const |
Referenced by insert_filtered(), and OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::process_gap_i().
bool OpenDDS::DCPS::DisjointSequence::contains_any | ( | const SequenceRange & | range | ) | const |
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::include_fragment(), and insert_filtered().
ACE_INLINE SequenceNumber OpenDDS::DCPS::DisjointSequence::cumulative_ack | ( | ) | const |
Gets the high end of the lowest contiguous range. Named after the use case of tracking received messages (which may be received out-of-order) and then determining the largest value that the receiver is allowed to acknowledge (under a cumulative-acking protocol). If empty(), returns SEQUENCENUMBER_UNKNOWN.
Definition at line 26 of file DisjointSequence.inl.
References ACE_INLINE, OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::begin(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::empty(), OpenDDS::DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN(), and sequences_.
Referenced by OpenDDS::DCPS::ReliableSession::deliver_held_data(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::gather_ack_nacks_i(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_gaps_i(), OpenDDS::DCPS::ReliableSession::ready_to_deliver(), OpenDDS::DCPS::ReliableSession::send_naks(), and to_bitmap().
ACE_INLINE bool OpenDDS::DCPS::DisjointSequence::disjoint | ( | ) | const |
Objects with the disjoint() property have an internal gap in the inserted SequenceNumbers.
Definition at line 48 of file DisjointSequence.inl.
References ACE_INLINE, sequences_, and OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::size().
Referenced by fill_bitmap_range(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::gather_ack_nacks_i(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_gaps_i(), OpenDDS::DCPS::ReliableSession::ready_to_deliver(), OpenDDS::DCPS::ReliableSession::send_naks(), and to_bitmap().
void OpenDDS::DCPS::DisjointSequence::dump | ( | void | ) | const |
Definition at line 319 of file DisjointSequence.cpp.
References ACE_DEBUG, OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::begin(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::end(), LM_DEBUG, and sequences_.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_nack_replies_i(), and OpenDDS::DCPS::ReliableSession::send_naks().
ACE_INLINE bool OpenDDS::DCPS::DisjointSequence::empty | ( | void | ) | const |
Definition at line 42 of file DisjointSequence.inl.
References ACE_INLINE, OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::empty(), and sequences_.
Referenced by OpenDDS::DCPS::ReliableSession::deliver_held_data(), OpenDDS::DCPS::RtpsUdpDataLink::durability_resend(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::gather_ack_nacks_i(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_gaps_i(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_nack_replies_i(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::process_gap_i(), OpenDDS::DCPS::ReliableSession::ready_to_deliver(), and OpenDDS::DCPS::SingleSendBuffer::resend_fragments_i().
void OpenDDS::DCPS::DisjointSequence::erase | ( | SequenceNumber | value | ) |
Definition at line 337 of file DisjointSequence.cpp.
References OPENDDS_END_VERSIONED_NAMESPACE_DECL, OpenDDS::DCPS::SequenceNumber::previous(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::ranges_, and sequences_.
Referenced by OpenDDS::DCPS::WriteDataContainer::reenqueue_all().
|
static |
Set the bits in range [low, high] in the bitmap, updating num_bits.
Definition at line 238 of file DisjointSequence.cpp.
References OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::begin(), disjoint(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::end(), OPENDDS_VECTOR(), OpenDDS::DCPS::SequenceNumber::previous(), and sequences_.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::extend_bitmap_range(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::gather_ack_nacks_i(), OpenDDS::DCPS::TransportReassembly::get_gaps(), and to_bitmap().
ACE_INLINE SequenceNumber OpenDDS::DCPS::DisjointSequence::high | ( | ) | const |
Highest SequenceNumber in the set. Precondition: !empty()
Definition at line 20 of file DisjointSequence.inl.
References ACE_INLINE, OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::rbegin(), and sequences_.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::gather_ack_nacks_i(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_gaps_i(), insert_bitmap_range(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::process_gap_i(), and to_bitmap().
ACE_INLINE bool OpenDDS::DCPS::DisjointSequence::insert | ( | const SequenceRange & | range, |
OPENDDS_VECTOR(SequenceRange)& | added | ||
) |
All insert() methods return true upon modifying the set and false if the set already contained the SequenceNumber(s) that were to be inserted. This is the general form of insert() whereby the caller receives a list of sub-ranges of 'range' that were not already in the DisjointSequence. For example, given a DisjointSequence 'seq' containing (1, 2, 5, 9), calling seq.insert(SequenceRange(4, 12), v) returns true and yields v = [(4, 4), (6, 8), (10, 12)] and seq = (1, 2, 4, ..., 12).
Definition at line 77 of file DisjointSequence.inl.
References ACE_INLINE, and insert_i().
Referenced by OpenDDS::DCPS::WriteDataContainer::add_reader_acks(), OpenDDS::DCPS::ReliableSession::check_header(), OpenDDS::DCPS::RtpsUdpDataLink::durability_resend(), OpenDDS::DCPS::ReliableSession::expire_naks(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_nack_replies_i(), insert_filtered(), OpenDDS::DCPS::ReliableSession::nakack_received(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::process_gap_i(), OpenDDS::DCPS::ReliableSession::record_header_received(), OpenDDS::DCPS::SingleSendBuffer::resend_i(), OpenDDS::DCPS::ReliableSession::send_naks(), and OpenDDS::DCPS::ReliableSession::syn_hook().
ACE_INLINE bool OpenDDS::DCPS::DisjointSequence::insert | ( | const SequenceRange & | range | ) |
Insert all numbers between range.first and range.second (both inclusive).
Definition at line 71 of file DisjointSequence.inl.
References ACE_INLINE, and insert_i().
ACE_INLINE bool OpenDDS::DCPS::DisjointSequence::insert | ( | SequenceNumber | value | ) |
Shorthand for "insert(SequenceRange(value, value))".
Definition at line 65 of file DisjointSequence.inl.
References ACE_INLINE, and insert_i().
bool OpenDDS::DCPS::DisjointSequence::insert | ( | SequenceNumber | value, |
ACE_CDR::ULong | num_bits, | ||
const ACE_CDR::Long | bits[] | ||
) |
Insert using the RTPS compact representation of a set. The three parameters, taken together, describe a set with each 1 bit starting at the msb of bits[0] and extending through num_bits (which are located at the next least significant bits of bits[0] followed by the msb of bits[1], etc.) indicating presence of the number (value + bit_index) in the set. bit_index is 0-based. Precondition: the array 'bits' has at least ceil(num_bits / 32) entries.
Definition at line 91 of file DisjointSequence.cpp.
References OpenDDS::DCPS::SequenceNumber::getValue(), insert_bitmap_range(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::ranges_, and sequences_.
|
private |
Definition at line 155 of file DisjointSequence.cpp.
References OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::empty(), high(), low(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::ranges_, and sequences_.
Referenced by insert().
ACE_INLINE bool OpenDDS::DCPS::DisjointSequence::insert_filtered | ( | const SequenceRange & | range, |
const DisjointSequence & | filter | ||
) |
Insert the intersection of range and filter.
Definition at line 84 of file DisjointSequence.inl.
References ACE_INLINE, OpenDDS::DCPS::back_inserter(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::begin(), contains(), contains_any(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::end(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::has(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::has_any(), insert(), OPENDDS_END_VERSIONED_NAMESPACE_DECL, OPENDDS_VECTOR(), sequences_, and value.
|
private |
Definition at line 28 of file DisjointSequence.cpp.
References OPENDDS_ASSERT, OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::ranges_, sequences_, and OpenDDS::DCPS::SequenceNumber::ZERO().
Referenced by insert().
ACE_INLINE SequenceNumber OpenDDS::DCPS::DisjointSequence::last_ack | ( | ) | const |
Gets the low end of the highest contiguous range, may be thought of as the inverse of cumulative_ack(). If empty(), returns SEQUENCENUMBER_UNKNOWN.
Definition at line 34 of file DisjointSequence.inl.
References ACE_INLINE, OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::empty(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::rbegin(), OpenDDS::DCPS::SequenceNumber::SEQUENCENUMBER_UNKNOWN(), and sequences_.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::gather_ack_nacks_i().
ACE_INLINE SequenceNumber OpenDDS::DCPS::DisjointSequence::low | ( | ) | const |
Lowest SequenceNumber in the set. Precondition: !empty()
Definition at line 14 of file DisjointSequence.inl.
References ACE_INLINE, OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::begin(), and sequences_.
Referenced by OpenDDS::DCPS::ReliableSession::deliver_held_data(), OpenDDS::DCPS::ReliableSession::expire_naks(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_gaps_i(), insert_bitmap_range(), OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::process_gap_i(), OpenDDS::DCPS::ReliableSession::ready_to_deliver(), OpenDDS::DCPS::ReliableSession::send_naks(), and to_bitmap().
OpenDDS::DCPS::DisjointSequence::OPENDDS_VECTOR | ( | SequenceRange | ) | const |
Returns missing ranges of SequenceNumbers (internal gaps in the sequence)
Referenced by fill_bitmap_range(), and insert_filtered().
OpenDDS::DCPS::DisjointSequence::OPENDDS_VECTOR | ( | SequenceRange | ) | const |
Returns a representation of the members of the sequence as a list of contiguous ranges (each Range is inclusive on both sides).
ACE_INLINE void OpenDDS::DCPS::DisjointSequence::reset | ( | void | ) |
Definition at line 59 of file DisjointSequence.inl.
References ACE_INLINE, OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::clear(), and sequences_.
Referenced by OpenDDS::DCPS::WriteDataContainer::add_reader_acks(), and OpenDDS::DCPS::ReliableSession::syn_hook().
bool OpenDDS::DCPS::DisjointSequence::to_bitmap | ( | ACE_CDR::Long | bitmap[], |
ACE_CDR::ULong | length, | ||
ACE_CDR::ULong & | num_bits, | ||
ACE_CDR::ULong & | cumulative_bits_added, | ||
bool | invert = false |
||
) | const |
Inverse of insert(value, num_bits, bits). Populates array of bitmap[length] with the bitmap of ranges above the cumulative_ack() value. Sets the number of significant (used) bits in num_bits. The 'base' of the bitmap is one larger than cumulative_ack(). Returns true if the entire DisjointSequence was able to fit in bitmap[]. Returning false is not an error, it's just that the higher-valued ranges didn't fit. If invert is true, the 1's in the bitmap represent the missing_sequence_ranges() instead of the present_sequence_ranges(). Precondition: the array 'bits' has 'length' entries allocated.
Definition at line 204 of file DisjointSequence.cpp.
References OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::begin(), cumulative_ack(), disjoint(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::end(), fill_bitmap_range(), OpenDDS::DCPS::SequenceNumber::getValue(), high(), low(), and sequences_.
Referenced by OpenDDS::DCPS::RtpsUdpDataLink::RtpsReader::gather_ack_nacks_i(), and OpenDDS::DCPS::RtpsUdpDataLink::RtpsWriter::gather_gaps_i().
|
private |
Definition at line 275 of file DisjointSequence.h.
Referenced by cumulative_ack(), disjoint(), dump(), empty(), erase(), fill_bitmap_range(), high(), insert(), insert_bitmap_range(), insert_filtered(), insert_i(), last_ack(), low(), reset(), and to_bitmap().