MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / generate

Method generate

tools/monitor/GraphGenerator.cpp:103–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void
104Monitor::GraphGenerator::generate(TreeNode *t)
105{
106 if (t == 0) {
107 return;
108 }
109
110 bool hasSubG = false; // used to know when to push '}' to end subgraphs
111 bool stopDescent = false; // flag to stop visiting children.
112
113 // print this node
114 // skip the root and make sure we have a key AND a value
115 if (t != root_ && t->width() >= 2) {
116 if (!honorDisplayFlag_ || (honorDisplayFlag_ && t->display())) {
117 std::string key = t->column(0).toString().toLocal8Bit().constData();
118 std::string val = t->column(1).toString().toLocal8Bit().constData();
119 htmlEncode(key);
120 htmlEncode(val);
121 QColor kc = (t->color(0)).value<QColor>();
122 QColor vc = (t->color(1)).value<QColor>();
123
124 // host and process nodes
125 if ((key == "Host" && !gvOpt_.ignoreHosts()) ||
126 (key == "Process" && !gvOpt_.ignoreProcs()) ||
127 (key == "DomainParticipant")) {
128
129 if (key == "DomainParticipant" && gvOpt_.abbrGUIDs()) {
130 val = abbr(val);
131 }
132
133 hasSubG = true;
134
135 std::string id("\"cluster_");
136 id += nodeName();
137 id += "\"";
138 fout << "subgraph " << id << " {" << std::endl;
139 fout << " label=\"" << key << ":" << val << "\";" << std::endl;
140 lifo_.push("}\n");
141 }
142 else if ((key == "Publisher" && !gvOpt_.ignorePubs()) ||
143 (key == "Subscriber" && !gvOpt_.ignoreSubs())) {
144 hasSubG = true;
145
146 std::string id("\"cluster_");
147 id += nodeName();
148
149 fout << "subgraph " << id << "\" {" << std::endl;
150 fout << " label=\"" << key << ":" << val << "\";" << std::endl;
151
152 lifo_.push("}\n");
153 }
154 else if (key == "Topic" && !gvOpt_.hideTopics()) {
155 // TODO: The Topic and Transport logic is ugly. It needs to be refactored
156 // Perhaps break this long if..else clause into seaprate methods
157 // for each type of node.
158
159 // Topic is a node has GUID and TopicName
160 stopDescent = true; // no need to go below a topic

Callers

nothing calls this directly

Calls 15

generateFunction · 0.85
widthMethod · 0.80
displayMethod · 0.80
columnMethod · 0.80
colorMethod · 0.80
popMethod · 0.80
toStringMethod · 0.45
ignoreHostsMethod · 0.45
ignoreProcsMethod · 0.45
abbrGUIDsMethod · 0.45
pushMethod · 0.45
ignorePubsMethod · 0.45

Tested by

no test coverage detected