Mads
Multi-Agent Distributed System
Loading...
Searching...
No Matches
topology_graph.hpp
Go to the documentation of this file.
1/*
2 _____ _ ____ _
3|_ _|__ _ __ ___ | | ___ __ _ _ _ / ___|_ __ __ _ _ __ | |__
4 | |/ _ \| '_ \ / _ \| |/ _ \ / _` | | | | | _| '__/ _` | '_ \| '_ \
5 | | (_) | |_) | (_) | | (_) | (_| | |_| | |_| | | | (_| | |_) | | | |
6 |_|\___/| .__/ \___/|_|\___/ \__, |\__, |\____|_| \__,_| .__/|_| |_|
7 |_| |___/ |___/ |_|
8
9Pure DOT-graph builder backing `mads doctor --graph` (src/main/doctor.cpp).
10
11Takes an already-parsed map of `section name -> {pub_topic, sub_topic[]}` --
12one entry per `mads.ini` agent section -- and returns Graphviz DOT text
13describing the declared pub/sub topology. No ZMQ, no `Agent`, no file I/O:
14the ini-parsing and file/stdout writing both stay in src/main/doctor.cpp,
15exactly like src/topic_match.hpp (from P2), which this module reuses
16directly for edge/dangling detection so the graph is faithful to the exact
17matching semantics `Agent::connect_sub()` applies at runtime.
18
19Author(s): Paolo Bosetti
20*/
21#pragma once
22
23#include <map>
24#include <optional>
25#include <string>
26#include <vector>
27
28namespace Mads {
29
35 std::string pub_topic;
40 std::vector<std::string> sub_topic;
48 bool pub_implicit = false;
49};
50
61using LiveSubscriptions = std::map<std::string, int>;
62
70bool is_implicitly_subscribed_topic(const std::string &topic);
71
82 bool expand_catch_all = false;
83
99 std::optional<LiveSubscriptions> live;
100};
101
139std::string topology_graph(const std::map<std::string, AgentTopicInfo> &agents,
140 const GraphOptions &options = {});
141
142} // namespace Mads
Definition agent.hpp:67
std::map< std::string, int > LiveSubscriptions
bool is_implicitly_subscribed_topic(const std::string &topic)
std::string topology_graph(const std::map< std::string, AgentTopicInfo > &agents, const GraphOptions &options={})
Builds Graphviz DOT text describing the declared pub/sub topology of a set of agent sections.
One mads.ini agent section's topics.
std::vector< std::string > sub_topic
Rendering knobs for topology_graph().
std::optional< LiveSubscriptions > live