Doxygen
Loading...
Searching...
No Matches
DotInclDepGraph Class Reference

Representation of an include dependency graph. More...

#include <src/dotincldepgraph.h>

+ Inheritance diagram for DotInclDepGraph:
+ Collaboration diagram for DotInclDepGraph:

Public Member Functions

 DotInclDepGraph (const FileDef *fd, bool inverse)
 
 ~DotInclDepGraph () override
 
QCString writeGraph (TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1)
 
bool isTrivial () const
 
bool isTooBig () const
 
int numNodes () const
 
void writeXML (TextStream &t)
 
void writeDocbook (TextStream &t)
 
- Public Member Functions inherited from DotGraph
 DotGraph ()
 
virtual ~DotGraph ()=default
 

Protected Member Functions

QCString getBaseName () const override
 
QCString getMapLabel () const override
 
void computeTheGraph () override
 
- Protected Member Functions inherited from DotGraph
int getNextNodeNumber ()
 returns the node number.
 
int getNextEdgeNumber ()
 returns the edge number.
 
QCString writeGraph (TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1)
 
virtual QCString absMapName () const
 
virtual QCString getImgAltText () const
 
QCString absBaseName () const
 
QCString absDotName () const
 
QCString imgName () const
 
QCString absImgName () const
 
QCString relImgName () const
 

Private Member Functions

QCString diskName () const
 
void buildGraph (DotNode *n, const FileDef *fd, int distance)
 
void determineVisibleNodes (DotNodeDeque &queue, int &maxNodes)
 
void determineTruncatedNodes (DotNodeDeque &queue)
 

Private Attributes

DotNodem_startNode
 
DotNodeMap m_usedNodes
 
QCString m_inclDepFileName
 
QCString m_inclByDepFileName
 
bool m_inverse
 

Additional Inherited Members

- Static Protected Member Functions inherited from DotGraph
static void writeGraphHeader (TextStream &t, const QCString &title=QCString())
 
static void writeGraphFooter (TextStream &t)
 
static void computeGraph (DotNode *root, GraphType gt, GraphOutputFormat format, const QCString &rank, bool renderParents, bool backArrows, const QCString &title, QCString &graphStr)
 
- Protected Attributes inherited from DotGraph
GraphOutputFormat m_graphFormat = GraphOutputFormat::BITMAP
 
EmbeddedOutputFormat m_textFormat = EmbeddedOutputFormat::Html
 
Dir m_dir
 
QCString m_fileName
 
QCString m_relPath
 
bool m_generateImageMap = false
 
int m_graphId = 0
 
QCString m_absPath
 
QCString m_baseName
 
QCString m_theGraph
 
bool m_regenerate = false
 
bool m_doNotAddImageToIndex = false
 
bool m_noDivTag = false
 
bool m_zoomable = true
 
bool m_urlOnly = false
 

Detailed Description

Representation of an include dependency graph.

Definition at line 30 of file dotincldepgraph.h.

Constructor & Destructor Documentation

◆ DotInclDepGraph()

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

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}
virtual QCString briefDescriptionAsTooltip() const =0
virtual QCString getReference() const =0
virtual QCString getOutputFileBase() const =0
friend class DotNode
Definition dotgraph.h:36
void determineVisibleNodes(DotNodeDeque &queue, int &maxNodes)
DotNodeMap m_usedNodes
QCString m_inclDepFileName
void determineTruncatedNodes(DotNodeDeque &queue)
DotNode * m_startNode
void buildGraph(DotNode *n, const FileDef *fd, int distance)
QCString m_inclByDepFileName
virtual QCString absFilePath() const =0
virtual QCString includedByDependencyGraphFileName() const =0
virtual const QCString & docName() const =0
virtual QCString includeDependencyGraphFileName() const =0
const std::string & str() const
Definition qcstring.h:526
#define Config_getInt(name)
Definition config.h:34
#define TRUE
Definition qcstring.h:37
#define ASSERT(x)
Definition qcstring.h:39

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.

◆ ~DotInclDepGraph()

DotInclDepGraph::~DotInclDepGraph ( )
override

Definition at line 149 of file dotincldepgraph.cpp.

150{
152}
static void deleteNodes(DotNode *node)
Definition dotnode.cpp:380

References DotNode::deleteNodes(), and m_startNode.

Member Function Documentation

◆ buildGraph()

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

Definition at line 22 of file dotincldepgraph.cpp.

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}
virtual bool isLinkable() const =0
virtual bool isHidden() const =0
virtual QCString getSourceFileBase() const =0
void setDistance(int distance)
Definition dotnode.cpp:366
void addParent(DotNode *n)
Definition dotnode.cpp:331
void addChild(DotNode *n, EdgeInfo::Colors edgeColor=EdgeInfo::Purple, EdgeInfo::Styles edgeStyle=EdgeInfo::Solid, const QCString &edgeLab=QCString(), const QCString &edgeURL=QCString(), int edgeLabCol=-1)
Definition dotnode.cpp:314
@ Solid
Definition dotnode.h:36
virtual bool generateSourceFile() const =0
virtual const IncludeInfoList & includeFileList() const =0
virtual const IncludeInfoList & includedByFileList() const =0
#define Config_getBool(name)
Definition config.h:33
#define FALSE
Definition qcstring.h:34

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().

◆ computeTheGraph()

void DotInclDepGraph::computeTheGraph ( )
overrideprotectedvirtual

Implements DotGraph.

Definition at line 166 of file dotincldepgraph.cpp.

167{
169 m_inverse, m_startNode->label(), m_theGraph);
170}
static void computeGraph(DotNode *root, GraphType gt, GraphOutputFormat format, const QCString &rank, bool renderParents, bool backArrows, const QCString &title, QCString &graphStr)
Definition dotgraph.cpp:306
GraphOutputFormat m_graphFormat
Definition dotgraph.h:85
QCString m_theGraph
Definition dotgraph.h:95
@ Dependency
Definition dotgraph.h:31

References DotGraph::computeGraph(), Dependency, FALSE, DotGraph::m_graphFormat, m_inverse, m_startNode, and DotGraph::m_theGraph.

◆ determineTruncatedNodes()

void DotInclDepGraph::determineTruncatedNodes ( DotNodeDeque & queue)
private

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}
DotNode & markAsTruncated(bool b=TRUE)
Definition dotnode.h:121
bool isVisible() const
Definition dotnode.h:104
@ Unknown
Definition dotnode.h:76
const DotNodeRefVector & children() const
Definition dotnode.h:122
TruncState isTruncated() const
Definition dotnode.h:105

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 )
private

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}
int distance() const
Definition dotnode.h:106
void markAsVisible(bool b=TRUE)
Definition dotnode.h:120

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

Referenced by DotInclDepGraph().

◆ diskName()

QCString DotInclDepGraph::diskName ( ) const
private

References DotGraph::DotNode.

◆ getBaseName()

QCString DotInclDepGraph::getBaseName ( ) const
overrideprotectedvirtual

Implements DotGraph.

Definition at line 154 of file dotincldepgraph.cpp.

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

References m_inclByDepFileName, m_inclDepFileName, and m_inverse.

◆ getMapLabel()

QCString DotInclDepGraph::getMapLabel ( ) const
overrideprotectedvirtual

Implements DotGraph.

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}
QCString escapeCharsInString(const QCString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:3684

References escapeCharsInString(), FALSE, m_inverse, and m_startNode.

◆ isTooBig()

bool DotInclDepGraph::isTooBig ( ) const

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 ( ) const

Definition at line 196 of file dotincldepgraph.cpp.

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

References m_startNode.

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

◆ numNodes()

int DotInclDepGraph::numNodes ( ) const

Definition at line 206 of file dotincldepgraph.cpp.

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

References m_startNode.

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

◆ writeDocbook()

void DotInclDepGraph::writeDocbook ( TextStream & t)

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 )

Definition at line 184 of file dotincldepgraph.cpp.

192{
193 return DotGraph::writeGraph(out, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId);
194}
QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path, const QCString &fileName, const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1)
Definition dotgraph.cpp:115

References DotGraph::writeGraph().

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

◆ writeXML()

void DotInclDepGraph::writeXML ( TextStream & t)

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().

Member Data Documentation

◆ m_inclByDepFileName

QCString DotInclDepGraph::m_inclByDepFileName
private

Definition at line 60 of file dotincldepgraph.h.

Referenced by DotInclDepGraph(), and getBaseName().

◆ m_inclDepFileName

QCString DotInclDepGraph::m_inclDepFileName
private

Definition at line 59 of file dotincldepgraph.h.

Referenced by DotInclDepGraph(), and getBaseName().

◆ m_inverse

bool DotInclDepGraph::m_inverse
private

◆ m_startNode

DotNode* DotInclDepGraph::m_startNode
private

◆ m_usedNodes

DotNodeMap DotInclDepGraph::m_usedNodes
private

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: