Goby3  3.0.1
2021.08.17

provides an API to the goby-acomms Queuing Library. More...

#include <goby/acomms/queue.h>

Public Member Functions

 QueueManager ()
 constructor More...
 
 ~QueueManager ()=default
 destructor More...
 
Initialization Methods

These methods are intended to be called before doing any work with the class.

void set_cfg (const protobuf::QueueManagerConfig &cfg)
 Set (and overwrite completely if present) the current configuration. (protobuf::QueueManagerConfig defined in acomms_queue.proto) More...
 
void merge_cfg (const protobuf::QueueManagerConfig &cfg)
 Set (and merge "repeat" fields) the current configuration. (protobuf::QueueManagerConfig defined in acomms_queue.proto) More...
 
template<typename ProtobufMessage >
void add_queue (const protobuf::QueuedMessageEntry &queue_cfg)
 Add a DCCL queue for use with QueueManager. Note that the queue must be added before receiving messages with QueueManager. More...
 
void add_queue (const google::protobuf::Descriptor *desc, const protobuf::QueuedMessageEntry &queue_cfg)
 Alternative method for adding Queues when using Dynamic Protobuf Messages. More...
 
Application level Push/Receive Methods

These methods are the primary higher level interface to the QueueManager. From here you can push messages and set the callbacks to use on received messages.

void push_message (const google::protobuf::Message &new_message)
 Push a message (and add the queue if it does not exist) More...
 
void push_message (const google::protobuf::Message &new_message, const protobuf::QueuedMessageMeta *meta)
 
void flush_queue (const protobuf::QueueFlush &flush)
 Flush (delete all messages in) a queue. More...
 
Modem Slots

These methods are the interface to the QueueManager from the modem driver.

void handle_modem_data_request (protobuf::ModemTransmission *msg)
 Finds data to send to the modem. More...
 
void handle_modem_receive (const protobuf::ModemTransmission &message)
 Receive incoming data from the modem. More...
 
Control

Call these methods when you want the QueueManager to perform time sensitive tasks (such as expiring old messages)

void do_work ()
 Calculates which messages have expired and emits the goby::acomms::QueueManager::signal_expire as necessary. More...
 
Informational Methods
void info_all (std::ostream *os) const
 Writes a human readable summary (including DCCLCodec info) of all loaded queues. More...
 
template<typename ProtobufMessage >
void info (std::ostream *os) const
 Writes a human readable summary (including DCCLCodec info) of the queue for the provided DCCL type to the stream provided. More...
 
void info (const google::protobuf::Descriptor *desc, std::ostream *os) const
 An alterative form for getting information for Queues for message types not known at compile-time ("dynamic"). More...
 
const std::string & glog_push_group ()
 
const std::string & glog_pop_group ()
 
const std::string & glog_priority_group ()
 
const std::string & glog_out_group ()
 
const std::string & glog_in_group ()
 
std::string msg_string (const google::protobuf::Descriptor *desc)
 
int modem_id ()
 The current modem ID (MAC address) of this node. More...
 
protobuf::QueuedMessageMeta meta_from_msg (const google::protobuf::Message &msg)
 

Detailed Description

provides an API to the goby-acomms Queuing Library.

See also
acomms_queue.proto and acomms_modem_message.proto for definition of Google Protocol Buffers messages (namespace goby::acomms::protobuf).

Definition at line 66 of file queue_manager.h.

Constructor & Destructor Documentation

◆ QueueManager()

goby::acomms::QueueManager::QueueManager ( )

constructor

◆ ~QueueManager()

goby::acomms::QueueManager::~QueueManager ( )
default

destructor

Member Function Documentation

◆ add_queue() [1/2]

void goby::acomms::QueueManager::add_queue ( const google::protobuf::Descriptor *  desc,
const protobuf::QueuedMessageEntry queue_cfg 
)

Alternative method for adding Queues when using Dynamic Protobuf Messages.

◆ add_queue() [2/2]

template<typename ProtobufMessage >
void goby::acomms::QueueManager::add_queue ( const protobuf::QueuedMessageEntry queue_cfg)
inline

Add a DCCL queue for use with QueueManager. Note that the queue must be added before receiving messages with QueueManager.

Template Parameters
ProtobufMessageAny Google Protobuf Message generated by protoc (i.e. subclass of google::protobuf::Message)

Definition at line 89 of file queue_manager.h.

◆ do_work()

void goby::acomms::QueueManager::do_work ( )

Calculates which messages have expired and emits the goby::acomms::QueueManager::signal_expire as necessary.

◆ flush_queue()

void goby::acomms::QueueManager::flush_queue ( const protobuf::QueueFlush flush)

Flush (delete all messages in) a queue.

Parameters
flushQueueFlush object containing details about queue to flush

◆ glog_in_group()

const std::string& goby::acomms::QueueManager::glog_in_group ( )
inline

Definition at line 170 of file queue_manager.h.

◆ glog_out_group()

const std::string& goby::acomms::QueueManager::glog_out_group ( )
inline

Definition at line 169 of file queue_manager.h.

◆ glog_pop_group()

const std::string& goby::acomms::QueueManager::glog_pop_group ( )
inline

Definition at line 167 of file queue_manager.h.

◆ glog_priority_group()

const std::string& goby::acomms::QueueManager::glog_priority_group ( )
inline

Definition at line 168 of file queue_manager.h.

◆ glog_push_group()

const std::string& goby::acomms::QueueManager::glog_push_group ( )
inline

Definition at line 166 of file queue_manager.h.

◆ handle_modem_data_request()

void goby::acomms::QueueManager::handle_modem_data_request ( protobuf::ModemTransmission msg)

Finds data to send to the modem.

Data from the highest priority queue(s) will be combined to form a message equal or less than the size requested in ModemMessage message_in. If using one of the classes inheriting ModemDriverBase, this method should be connected to ModemDriverBase::signal_data_request.

Parameters
msgThe ModemTransmission containing information about the data request and is the place where the request data will be stored (in the repeated field ModemTransmission::frame).

◆ handle_modem_receive()

void goby::acomms::QueueManager::handle_modem_receive ( const protobuf::ModemTransmission message)

Receive incoming data from the modem.

If using one of the classes inheriting ModemDriverBase, this method should be bound and passed to ModemDriverBase::signal_receive.

Parameters
messageThe received ModemMessage.

◆ info() [1/2]

void goby::acomms::QueueManager::info ( const google::protobuf::Descriptor *  desc,
std::ostream *  os 
) const

An alterative form for getting information for Queues for message types not known at compile-time ("dynamic").

◆ info() [2/2]

template<typename ProtobufMessage >
void goby::acomms::QueueManager::info ( std::ostream *  os) const
inline

Writes a human readable summary (including DCCLCodec info) of the queue for the provided DCCL type to the stream provided.

Template Parameters
ProtobufMessageAny Google Protobuf Message generated by protoc (i.e. subclass of google::protobuf::Message)
Parameters
osPointer to a stream to write this information

Definition at line 158 of file queue_manager.h.

◆ info_all()

void goby::acomms::QueueManager::info_all ( std::ostream *  os) const

Writes a human readable summary (including DCCLCodec info) of all loaded queues.

Parameters
osPointer to a stream to write this information

◆ merge_cfg()

void goby::acomms::QueueManager::merge_cfg ( const protobuf::QueueManagerConfig cfg)

Set (and merge "repeat" fields) the current configuration. (protobuf::QueueManagerConfig defined in acomms_queue.proto)

◆ meta_from_msg()

protobuf::QueuedMessageMeta goby::acomms::QueueManager::meta_from_msg ( const google::protobuf::Message msg)
inline

Definition at line 180 of file queue_manager.h.

◆ modem_id()

int goby::acomms::QueueManager::modem_id ( )
inline

The current modem ID (MAC address) of this node.

Definition at line 178 of file queue_manager.h.

◆ msg_string()

std::string goby::acomms::QueueManager::msg_string ( const google::protobuf::Descriptor *  desc)
inline

Definition at line 172 of file queue_manager.h.

◆ push_message() [1/2]

void goby::acomms::QueueManager::push_message ( const google::protobuf::Message new_message)

Push a message (and add the queue if it does not exist)

Parameters
new_messageDCCL message to push.

◆ push_message() [2/2]

void goby::acomms::QueueManager::push_message ( const google::protobuf::Message new_message,
const protobuf::QueuedMessageMeta meta 
)

◆ set_cfg()

void goby::acomms::QueueManager::set_cfg ( const protobuf::QueueManagerConfig cfg)

Set (and overwrite completely if present) the current configuration. (protobuf::QueueManagerConfig defined in acomms_queue.proto)


The documentation for this class was generated from the following file: