Goby3 3.3.0
2025.07.10
Loading...
Searching...
No Matches
route.h
Go to the documentation of this file.
1// Copyright 2011-2021:
2// GobySoft, LLC (2013-)
3// Massachusetts Institute of Technology (2007-2014)
4// Community contributors (see AUTHORS file)
5// File authors:
6// Toby Schneider <toby@gobysoft.org>
7//
8//
9// This file is part of the Goby Underwater Autonomy Project Libraries
10// ("The Goby Libraries").
11//
12// The Goby Libraries are free software: you can redistribute them and/or modify
13// them under the terms of the GNU Lesser General Public License as published by
14// the Free Software Foundation, either version 2.1 of the License, or
15// (at your option) any later version.
16//
17// The Goby Libraries are distributed in the hope that they will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU Lesser General Public License for more details.
21//
22// You should have received a copy of the GNU Lesser General Public License
23// along with Goby. If not, see <http://www.gnu.org/licenses/>.
24
25#ifndef GOBY_ACOMMS_ROUTE_ROUTE_H
26#define GOBY_ACOMMS_ROUTE_ROUTE_H
27
28#include <cstdint> // for uint32_t
29#include <map> // for map
30
31#include "goby/acomms/protobuf/route.pb.h" // for RouteManagerConfig
32#include "goby/util/debug_logger/flex_ostream.h" // for FlexOstream, glog
33#include "goby/util/debug_logger/term_color.h" // for Colors, Colors::yellow
34
35namespace google
36{
37namespace protobuf
38{
39class Message;
40} // namespace protobuf
41} // namespace google
42
43namespace goby
44{
45namespace acomms
46{
47class QueueManager;
48namespace protobuf
49{
50class QueuedMessageMeta;
51} // namespace protobuf
52
54{
55 public:
56 RouteManager() { glog.add_group("goby::acomms::route", util::Colors::yellow); }
57 ~RouteManager() = default;
58
61
63 const google::protobuf::Message& data_msg, int modem_id);
64
66 int modem_id);
67
69
70 bool is_in_route(int modem_id) { return route_index(modem_id) != -1; }
71
72 int route_index(int modem_id);
73
74 int find_next_hop(int us, int dest);
75 int find_next_route_hop(int us, int dest);
76
77 private:
78 RouteManager(const RouteManager&) = delete;
79 RouteManager& operator=(const RouteManager&) = delete;
80
81 void process_cfg();
82
83 private:
85
86 // maps (modem_id & subnet_mask) onto QueueManager
87 std::map<std::uint32_t, QueueManager*> subnet_map_;
88};
89} // namespace acomms
90} // namespace goby
91
92#endif
provides an API to the goby-acomms Queuing Library.
int find_next_route_hop(int us, int dest)
void handle_out(protobuf::QueuedMessageMeta *meta, const google::protobuf::Message &data_msg, int modem_id)
void handle_in(const protobuf::QueuedMessageMeta &meta, const google::protobuf::Message &data_msg, int modem_id)
void merge_cfg(const protobuf::RouteManagerConfig &cfg)
int find_next_hop(int us, int dest)
void set_cfg(const protobuf::RouteManagerConfig &cfg)
bool is_in_route(int modem_id)
Definition route.h:70
int route_index(int modem_id)
void add_subnet_queue(QueueManager *manager)
void add_group(const std::string &name, Colors::Color color=Colors::nocolor, const std::string &description="")
Add another group to the logger. A group provides related manipulator for categorizing log messages.
The global namespace for the Goby project.
util::FlexOstream glog
Access the Goby logger through this object.
Definition dccl.h:58