Goby3
3.1.5a
2024.05.23
|
Represents a time-dependent priority queue for several groups of messages (multiple DynamicSubBuffers) More...
#include <goby/acomms/buffer/dynamic_buffer.h>
Classes | |
struct | Value |
Public Types | |
using | subbuffer_id_type = std::string |
using | size_type = typename DynamicSubBuffer< T, Clock >::size_type |
using | modem_id_type = int |
Public Member Functions | |
DynamicBuffer () | |
DynamicBuffer (int id) | |
~DynamicBuffer () | |
void | create (modem_id_type dest_id, const subbuffer_id_type &sub_id, const goby::acomms::protobuf::DynamicBufferConfig &cfg) |
Create a new subbuffer with the given configuration. More... | |
void | create (modem_id_type dest_id, const subbuffer_id_type &sub_id, const std::vector< goby::acomms::protobuf::DynamicBufferConfig > &cfgs) |
Create a new subbuffer merging the given configuration (See DynamicSubBuffer() for details) More... | |
void | replace (modem_id_type dest_id, const subbuffer_id_type &sub_id, const goby::acomms::protobuf::DynamicBufferConfig &cfg) |
Replace an existing subbuffer with the given configuration (any messages in the subbuffer will be erased) More... | |
void | replace (modem_id_type dest_id, const subbuffer_id_type &sub_id, const std::vector< goby::acomms::protobuf::DynamicBufferConfig > &cfgs) |
Replace an existing subbuffer merging the given configuration (See DynamicSubBuffer() for details) More... | |
void | update (modem_id_type dest_id, const subbuffer_id_type &sub_id, const goby::acomms::protobuf::DynamicBufferConfig &cfg) |
Update an existing subbuffer without removing the messsages. More... | |
void | update (modem_id_type dest_id, const subbuffer_id_type &sub_id, const std::vector< goby::acomms::protobuf::DynamicBufferConfig > &cfgs) |
Update an existing subbuffer without removing the messsages (or creates the buffer if it doesn't already exist) More... | |
void | remove (modem_id_type dest_id, const subbuffer_id_type &sub_id) |
Remove an existing subbuffer. More... | |
std::vector< Value > | push (const Value &fvt) |
Push a new message to the buffer. More... | |
bool | empty () const |
Is this buffer empty (that is, are all subbuffers empty)? More... | |
size_type | size () const |
Size of the buffer (that is, sum of the subbuffer sizes) More... | |
Value | top (modem_id_type dest_id=goby::acomms::QUERY_DESTINATION_ID, size_type max_bytes=std::numeric_limits< size_type >::max(), typename Clock::duration ack_timeout=std::chrono::microseconds(0)) |
Returns the top value in a priority contest between all subbuffers. More... | |
bool | erase (const Value &value) |
Erase a value. More... | |
std::vector< Value > | expire () |
Erase any values that have exceeded their time-to-live. More... | |
DynamicSubBuffer< T, Clock > & | sub (modem_id_type dest_id, const subbuffer_id_type &sub_id) |
Reference a given subbuffer. More... | |
Represents a time-dependent priority queue for several groups of messages (multiple DynamicSubBuffers)
Definition at line 356 of file dynamic_buffer.h.
using goby::acomms::DynamicBuffer< T, Clock >::modem_id_type = int |
Definition at line 369 of file dynamic_buffer.h.
using goby::acomms::DynamicBuffer< T, Clock >::size_type = typename DynamicSubBuffer<T, Clock>::size_type |
Definition at line 368 of file dynamic_buffer.h.
using goby::acomms::DynamicBuffer< T, Clock >::subbuffer_id_type = std::string |
Definition at line 367 of file dynamic_buffer.h.
|
inline |
Definition at line 359 of file dynamic_buffer.h.
|
inline |
Definition at line 360 of file dynamic_buffer.h.
|
inline |
Definition at line 365 of file dynamic_buffer.h.
|
inline |
Create a new subbuffer with the given configuration.
This must be called before using functions that reference this subbuffer ID (e.g. push(...), erase(...))
dest_id | The modem id destination for these messages |
sub_id | An identifier for this subbuffer |
cfg | The configuration for this new subbuffer |
Definition at line 385 of file dynamic_buffer.h.
|
inline |
Create a new subbuffer merging the given configuration (See DynamicSubBuffer() for details)
This must be called before using functions that reference this subbuffer ID (e.g. push(...), erase(...))
dest_id | The modem id destination for these messages |
sub_id | An identifier for this subbuffer |
cfgs | The configuration for this new subbuffer |
Definition at line 397 of file dynamic_buffer.h.
|
inline |
Is this buffer empty (that is, are all subbuffers empty)?
Definition at line 479 of file dynamic_buffer.h.
|
inline |
Erase a value.
value | Value to erase (if it exists) |
goby::Exception | If subbuffer doesn't exist |
Definition at line 601 of file dynamic_buffer.h.
|
inline |
Erase any values that have exceeded their time-to-live.
Definition at line 609 of file dynamic_buffer.h.
|
inline |
Push a new message to the buffer.
fvt | Full tuple giving subbuffer id, time, and value |
goby::Exception | If subbuffer doesn't exist |
Definition at line 469 of file dynamic_buffer.h.
|
inline |
Remove an existing subbuffer.
dest_id | The modem id destination for these messages |
sub_id | An identifier for this subbuffer |
Definition at line 459 of file dynamic_buffer.h.
|
inline |
Replace an existing subbuffer with the given configuration (any messages in the subbuffer will be erased)
dest_id | The modem id destination for these messages |
sub_id | An identifier for this subbuffer |
cfg | The configuration for this replacement subbuffer |
Definition at line 411 of file dynamic_buffer.h.
|
inline |
Replace an existing subbuffer merging the given configuration (See DynamicSubBuffer() for details)
dest_id | The modem id destination for these messages |
sub_id | An identifier for this subbuffer |
cfgs | The configuration for this replacement subbuffer |
Definition at line 422 of file dynamic_buffer.h.
|
inline |
Size of the buffer (that is, sum of the subbuffer sizes)
Definition at line 494 of file dynamic_buffer.h.
|
inline |
Reference a given subbuffer.
goby::Exception | If subbuffer doesn't exist |
Definition at line 628 of file dynamic_buffer.h.
|
inline |
Returns the top value in a priority contest between all subbuffers.
dest_id | Modem id for this packet (can be QUERY_DESTINATION_ID to query all possible destinations) |
max_bytes | Maximum number of bytes in the returned message |
ack_timeout | Duration to wait before resending a value |
Definition at line 510 of file dynamic_buffer.h.
|
inline |
Update an existing subbuffer without removing the messsages.
dest_id | The modem id destination for these messages |
sub_id | An identifier for this subbuffer |
cfg | The configuration for this updated subbuffer |
Definition at line 434 of file dynamic_buffer.h.
|
inline |
Update an existing subbuffer without removing the messsages (or creates the buffer if it doesn't already exist)
dest_id | The modem id destination for these messages |
sub_id | An identifier for this subbuffer |
cfgs | The configuration for this updated subbuffer |
Definition at line 445 of file dynamic_buffer.h.