Skip to main content

The DotInclDepGraph Class Reference

Representation of an include dependency graph. More...

Declaration

class DotInclDepGraph { ... }

Included Headers

Base class

classDotGraph

A dot graph. More...

Public Constructors Index

DotInclDepGraph (const FileDef *fd, bool inverse)

Public Destructor Index

~DotInclDepGraph () override

Public Member Functions Index

QCStringwriteGraph (TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1)
boolisTrivial () const
boolisTooBig () const
intnumNodes () const
voidwriteXML (TextStream &t)
voidwriteDocbook (TextStream &t)

Protected Member Functions Index

QCStringgetBaseName () const override
QCStringgetMapLabel () const override
voidcomputeTheGraph () override

Private Member Functions Index

QCStringdiskName () const
voidbuildGraph (DotNode *n, const FileDef *fd, int distance)
voiddetermineVisibleNodes (DotNodeDeque &queue, int &maxNodes)
voiddetermineTruncatedNodes (DotNodeDeque &queue)

Private Member Attributes Index

DotNode *m_startNode
DotNodeMapm_usedNodes
QCStringm_inclDepFileName
QCStringm_inclByDepFileName
boolm_inverse

Description

Representation of an include dependency graph.

Definition at line 30 of file dotincldepgraph.h.

Public Constructors

DotInclDepGraph()

DotInclDepGraph::DotInclDepGraph (const FileDef * fd, bool inverse)

Declaration at line 33 of file dotincldepgraph.h, definition at line 123 of file dotincldepgraph.cpp.

124{
125 m_inverse = inverse;
126 ASSERT(fd!=nullptr);
129 QCString tmp_url=fd->getReference()+"$"+fd->getOutputFileBase();
130 QCString tooltip = fd->briefDescriptionAsTooltip();
131 m_startNode = new DotNode(this,
132 fd->docName(),
133 tooltip,
134 tmp_url,
135 TRUE); // root node
136 m_startNode->setDistance(0);
137 m_usedNodes.emplace(fd->absFilePath().str(),m_startNode);
139
140 int maxNodes = Config_getInt(DOT_GRAPH_MAX_NODES);
141 DotNodeDeque openNodeQueue;
142 openNodeQueue.push_back(m_startNode);
143 determineVisibleNodes(openNodeQueue,maxNodes);
144 openNodeQueue.clear();
145 openNodeQueue.push_back(m_startNode);
146 determineTruncatedNodes(openNodeQueue);
147}

References FileDef::absFilePath, ASSERT, Definition::briefDescriptionAsTooltip, buildGraph, Config_getInt, determineTruncatedNodes, determineVisibleNodes, FileDef::docName, DotGraph::DotNode, Definition::getOutputFileBase, Definition::getReference, FileDef::includedByDependencyGraphFileName, FileDef::includeDependencyGraphFileName, m_inclByDepFileName, m_inclDepFileName, m_inverse, m_startNode, m_usedNodes, QCString::str and TRUE.

Public Destructor

~DotInclDepGraph()

DotInclDepGraph::~DotInclDepGraph ()

Declaration at line 34 of file dotincldepgraph.h, definition at line 149 of file dotincldepgraph.cpp.

References DotNode::deleteNodes and m_startNode.

Public Member Functions

isTooBig()

bool DotInclDepGraph::isTooBig ()

Declaration at line 41 of file dotincldepgraph.h, definition at line 201 of file dotincldepgraph.cpp.

202{
203 return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES);
204}

References Config_getInt and numNodes.

Referenced by FileDefImpl::writeIncludedByGraph and FileDefImpl::writeIncludeGraph.

isTrivial()

bool DotInclDepGraph::isTrivial ()

Declaration at line 40 of file dotincldepgraph.h, definition at line 196 of file dotincldepgraph.cpp.

197{
198 return m_startNode->children().empty();
199}

Reference m_startNode.

Referenced by generateXMLForFile, FileDefImpl::writeIncludedByGraph and FileDefImpl::writeIncludeGraph.

numNodes()

int DotInclDepGraph::numNodes ()

Declaration at line 42 of file dotincldepgraph.h, definition at line 206 of file dotincldepgraph.cpp.

207{
208 return static_cast<int>(m_startNode->children().size());
209}

Reference m_startNode.

Referenced by isTooBig, FileDefImpl::writeIncludedByGraph and FileDefImpl::writeIncludeGraph.

writeDocbook()

void DotInclDepGraph::writeDocbook (TextStream & t)

Declaration at line 44 of file dotincldepgraph.h, definition at line 219 of file dotincldepgraph.cpp.

220{
221 for (const auto &[name,node] : m_usedNodes)
222 {
223 node->writeDocbook(t,FALSE);
224 }
225}

References FALSE and m_usedNodes.

writeGraph()

QCString DotInclDepGraph::writeGraph (TextStream & t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString & path, const QCString & fileName, const QCString & relPath, bool writeImageMap=TRUE, int graphId=-1)

Declaration at line 37 of file dotincldepgraph.h, definition at line 184 of file dotincldepgraph.cpp.

185 GraphOutputFormat graphFormat,
186 EmbeddedOutputFormat textFormat,
187 const QCString &path,
188 const QCString &fileName,
189 const QCString &relPath,
190 bool generateImageMap,
191 int graphId)
192{
193 return DotGraph::writeGraph(out, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId);
194}

Reference DotGraph::writeGraph.

Referenced by DocbookGenerator::endInclDepGraph, HtmlGenerator::endInclDepGraph, LatexGenerator::endInclDepGraph and RTFGenerator::endInclDepGraph.

writeXML()

void DotInclDepGraph::writeXML (TextStream & t)

Declaration at line 43 of file dotincldepgraph.h, definition at line 211 of file dotincldepgraph.cpp.

212{
213 for (const auto &[name,node] : m_usedNodes)
214 {
215 node->writeXML(t,FALSE);
216 }
217}

References FALSE and m_usedNodes.

Referenced by generateXMLForFile.

Protected Member Functions

computeTheGraph()

void DotInclDepGraph::computeTheGraph ()
protected virtual

getBaseName()

QCString DotInclDepGraph::getBaseName ()
protected virtual

Declaration at line 47 of file dotincldepgraph.h, definition at line 154 of file dotincldepgraph.cpp.

155{
156 if (m_inverse)
157 {
159 }
160 else
161 {
162 return m_inclDepFileName;
163 }
164}

References m_inclByDepFileName, m_inclDepFileName and m_inverse.

getMapLabel()

QCString DotInclDepGraph::getMapLabel ()
protected virtual

Declaration at line 48 of file dotincldepgraph.h, definition at line 172 of file dotincldepgraph.cpp.

173{
174 if (m_inverse)
175 {
176 return escapeCharsInString(m_startNode->label(),FALSE) + "dep";
177 }
178 else
179 {
180 return escapeCharsInString(m_startNode->label(),FALSE);
181 }
182}

References escapeCharsInString, FALSE, m_inverse and m_startNode.

Private Member Functions

buildGraph()

void DotInclDepGraph::buildGraph (DotNode * n, const FileDef * fd, int distance)

Declaration at line 53 of file dotincldepgraph.h, definition at line 22 of file dotincldepgraph.cpp.

22void DotInclDepGraph::buildGraph(DotNode *n,const FileDef *fd,int distance)
23{
24 const IncludeInfoList &includeFiles = m_inverse ? fd->includedByFileList() : fd->includeFileList();
25 for (const auto &ii : includeFiles)
26 {
27 const FileDef *bfd = ii.fileDef;
28 QCString in = ii.includeName;
29 //printf(">>>> in='%s' bfd=%p\n",qPrint(ii->includeName),bfd);
30 bool doc=TRUE,src=FALSE;
31 if (bfd)
32 {
33 in = bfd->absFilePath();
34 doc = bfd->isLinkable() && !bfd->isHidden();
35 src = bfd->generateSourceFile();
36 }
37 if (doc || src || !Config_getBool(HIDE_UNDOC_RELATIONS))
38 {
39 QCString url="";
40 if (bfd) url=bfd->getOutputFileBase();
41 if (!doc && src)
42 {
43 url=bfd->getSourceFileBase();
44 }
45 auto it = m_usedNodes.find(in.str());
46 if (it!=m_usedNodes.end()) // file is already a node in the graph
47 {
48 DotNode *bn = it->second;
50 bn->addParent(n);
51 bn->setDistance(distance);
52 }
53 else
54 {
55 QCString tmp_url;
56 QCString tooltip;
57 if (bfd)
58 {
59 tmp_url=doc || src ? bfd->getReference()+"$"+url : QCString();
60 tooltip = bfd->briefDescriptionAsTooltip();
61 }
62 DotNode *bn = new DotNode(this,
63 ii.includeName, // label
64 tooltip, // tip
65 tmp_url, // url
66 FALSE, // rootNode
67 nullptr); // cd
69 bn->addParent(n);
70 m_usedNodes.emplace(in.str(),bn);
71 bn->setDistance(distance);
72
73 if (bfd) buildGraph(bn,bfd,distance+1);
74 }
75 }
76 }
77}

References FileDef::absFilePath, DotNode::addChild, DotNode::addParent, EdgeInfo::Blue, Definition::briefDescriptionAsTooltip, buildGraph, Config_getBool, DotGraph::DotNode, FALSE, FileDef::generateSourceFile, Definition::getOutputFileBase, Definition::getReference, Definition::getSourceFileBase, FileDef::includedByFileList, FileDef::includeFileList, Definition::isHidden, Definition::isLinkable, m_inverse, m_usedNodes, DotNode::setDistance, EdgeInfo::Solid, QCString::str and TRUE.

Referenced by buildGraph and DotInclDepGraph.

determineTruncatedNodes()

void DotInclDepGraph::determineTruncatedNodes (DotNodeDeque & queue)

Declaration at line 55 of file dotincldepgraph.h, definition at line 98 of file dotincldepgraph.cpp.

99{
100 while (!queue.empty())
101 {
102 DotNode *n = queue.front();
103 queue.pop_front();
104 if (n->isVisible() && n->isTruncated()==DotNode::Unknown)
105 {
106 bool truncated = FALSE;
107 for (const auto &dn : n->children())
108 {
109 if (!dn->isVisible())
110 {
111 truncated = TRUE;
112 }
113 else
114 {
115 queue.push_back(dn);
116 }
117 }
118 n->markAsTruncated(truncated);
119 }
120 }
121}

References DotNode::children, DotGraph::DotNode, FALSE, DotNode::isTruncated, DotNode::isVisible, DotNode::markAsTruncated, TRUE and DotNode::Unknown.

Referenced by DotInclDepGraph.

determineVisibleNodes()

void DotInclDepGraph::determineVisibleNodes (DotNodeDeque & queue, int & maxNodes)

Declaration at line 54 of file dotincldepgraph.h, definition at line 79 of file dotincldepgraph.cpp.

80{
81 while (!queue.empty() && maxNodes>0)
82 {
83 DotNode *n = queue.front();
84 queue.pop_front();
85 if (!n->isVisible() && n->distance()<=Config_getInt(MAX_DOT_GRAPH_DEPTH)) // not yet processed
86 {
87 n->markAsVisible();
88 maxNodes--;
89 // add direct children
90 for (const auto &dn : n->children())
91 {
92 queue.push_back(dn);
93 }
94 }
95 }
96}

References DotNode::children, Config_getInt, DotNode::distance, DotGraph::DotNode, DotNode::isVisible and DotNode::markAsVisible.

Referenced by DotInclDepGraph.

diskName()

QCString DotInclDepGraph::diskName ()

Definition at line 52 of file dotincldepgraph.h.

Reference DotGraph::DotNode.

Private Member Attributes

m_inclByDepFileName

QCString DotInclDepGraph::m_inclByDepFileName

Definition at line 60 of file dotincldepgraph.h.

Referenced by DotInclDepGraph and getBaseName.

m_inclDepFileName

QCString DotInclDepGraph::m_inclDepFileName

Definition at line 59 of file dotincldepgraph.h.

Referenced by DotInclDepGraph and getBaseName.

m_inverse

bool DotInclDepGraph::m_inverse

Definition at line 61 of file dotincldepgraph.h.

Referenced by buildGraph, computeTheGraph, DotInclDepGraph, getBaseName and getMapLabel.

m_startNode

DotNode* DotInclDepGraph::m_startNode

m_usedNodes

DotNodeMap DotInclDepGraph::m_usedNodes

Definition at line 58 of file dotincldepgraph.h.

Referenced by buildGraph, DotInclDepGraph, writeDocbook and writeXML.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.