|
Goby3 3.3.0
2025.07.10
|
Represents a time-dependent priority queue for a single group of messages (e.g. for a single DCCL ID) More...
#include <goby/acomms/buffer/dynamic_buffer.h>
Classes | |
| struct | Value |
Public Types | |
| enum class | ValueResult { VALUE_PROVIDED , EMPTY , IN_BLACKOUT , NEXT_MESSAGE_TOO_LARGE , ALL_MESSAGES_WAITING_FOR_ACK } |
| using | size_type = typename std::deque< T >::size_type |
Public Member Functions | |
| DynamicSubBuffer (const goby::acomms::protobuf::DynamicBufferConfig &cfg) | |
| Create a subbuffer with the given configuration. | |
| DynamicSubBuffer (const std::vector< goby::acomms::protobuf::DynamicBufferConfig > &cfgs) | |
| Create a subbuffer merging two or more configuration objects. | |
| ~DynamicSubBuffer () | |
| void | update (const std::vector< goby::acomms::protobuf::DynamicBufferConfig > &cfgs) |
| Update the configurations without clearing the buffer. | |
| const goby::acomms::protobuf::DynamicBufferConfig & | cfg () const |
| Return the aggregate configuration. | |
| Value & | top (typename Clock::time_point reference=Clock::now(), typename Clock::duration ack_timeout=std::chrono::microseconds(0)) |
| Returns the value at the top of the queue that hasn't been sent wihin ack_timeout. | |
| size_t | top_size (typename Clock::time_point reference=Clock::now(), typename Clock::duration ack_timeout=std::chrono::microseconds(0)) const |
| Returns the size (in bytes) of the top of the queue that hasn't been sent within ack_timeout. | |
| bool | all_waiting_for_ack (typename Clock::time_point reference=Clock::now(), typename Clock::duration ack_timeout=std::chrono::microseconds(0)) const |
| returns true if all messages have been sent within ack_timeout of the reference provided and thus none are available for resending yet | |
| std::pair< double, ValueResult > | top_value (typename Clock::time_point reference=Clock::now(), size_type max_bytes=std::numeric_limits< size_type >::max(), typename Clock::duration ack_timeout=std::chrono::microseconds(0)) const |
| Provides the numerical priority value based on this subbuffer's base priority, time-to-live (ttl) and time since last access (last call to top()) | |
| bool | in_blackout (typename Clock::time_point reference=Clock::now()) const |
| Returns if buffer is in blackout. | |
| bool | empty () const |
| Returns if this queue is empty. | |
| size_type | size () const |
| Retrieves the size of the queue. | |
| void | pop () |
| Pop the value on the top of the queue. | |
| std::vector< Value > | push (const T &t, typename Clock::time_point reference=Clock::now()) |
| Push a value to the queue. | |
| std::vector< Value > | expire (typename Clock::time_point reference=Clock::now()) |
| Erase any values that have exceeded their time-to-live. | |
| bool | erase (const Value &value) |
| Erase a value. | |
Represents a time-dependent priority queue for a single group of messages (e.g. for a single DCCL ID)
Definition at line 65 of file dynamic_buffer.h.
| using goby::acomms::DynamicSubBuffer< T, Clock >::size_type = typename std::deque<T>::size_type |
Definition at line 68 of file dynamic_buffer.h.
|
strong |
| Enumerator | |
|---|---|
| VALUE_PROVIDED | |
| EMPTY | |
| IN_BLACKOUT | |
| NEXT_MESSAGE_TOO_LARGE | |
| ALL_MESSAGES_WAITING_FOR_ACK | |
Definition at line 206 of file dynamic_buffer.h.
|
inline |
Create a subbuffer with the given configuration.
Definition at line 78 of file dynamic_buffer.h.
|
inline |
Create a subbuffer merging two or more configuration objects.
These configurations are merged using the following rules:
ttl and value_base are averagedack_required: true takes priority over falsenewest_first: true takes priority over falseblackout_time: the smaller value takes precedencequeue_size: the larger value takes precedence Definition at line 91 of file dynamic_buffer.h.
|
inline |
Definition at line 96 of file dynamic_buffer.h.
|
inline |
returns true if all messages have been sent within ack_timeout of the reference provided and thus none are available for resending yet
Definition at line 194 of file dynamic_buffer.h.
|
inline |
Return the aggregate configuration.
Definition at line 155 of file dynamic_buffer.h.
|
inline |
Returns if this queue is empty.
Definition at line 262 of file dynamic_buffer.h.
|
inline |
Erase a value.
| value | Value to erase (if it exists) |
Definition at line 323 of file dynamic_buffer.h.
|
inline |
Erase any values that have exceeded their time-to-live.
Definition at line 295 of file dynamic_buffer.h.
|
inline |
Returns if buffer is in blackout.
| reference | time point to use for current reference when calculating blackout |
Definition at line 254 of file dynamic_buffer.h.
|
inline |
Pop the value on the top of the queue.
Definition at line 268 of file dynamic_buffer.h.
|
inline |
Push a value to the queue.
| t | Value to push |
| reference | Reference time to use for this value (defaults to current time) |
Definition at line 275 of file dynamic_buffer.h.
|
inline |
Retrieves the size of the queue.
Definition at line 265 of file dynamic_buffer.h.
|
inline |
Returns the value at the top of the queue that hasn't been sent wihin ack_timeout.
| reference | Current time reference (defaults to now) |
| ack_timeout | Duration to wait before resending a value |
| DynamicBufferNoDataException | no data to (re)send |
Definition at line 163 of file dynamic_buffer.h.
|
inline |
Returns the size (in bytes) of the top of the queue that hasn't been sent within ack_timeout.
Definition at line 180 of file dynamic_buffer.h.
|
inline |
Provides the numerical priority value based on this subbuffer's base priority, time-to-live (ttl) and time since last access (last call to top())
| reference | time point to use for current reference when calculating this priority value (defaults to current time) |
| max_bytes | the maximum number of bytes requested |
| ack_timeout | how long to wait before resending the same value again |
Definition at line 222 of file dynamic_buffer.h.
|
inline |
Update the configurations without clearing the buffer.
Definition at line 99 of file dynamic_buffer.h.