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

Representation of a group collaboration graph. More...

#include <src/dotgroupcollaboration.h>

+ Inheritance diagram for DotGroupCollaboration:
+ Collaboration diagram for DotGroupCollaboration:

Classes

struct  Edge
 
struct  Link
 

Public Member Functions

 DotGroupCollaboration (const GroupDef *gd)
 
 ~DotGroupCollaboration () 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
 
- 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 Types

enum  EdgeType {
  tmember = 0 , tclass , tnamespace , tfile ,
  tpages , tdir , thierarchy
}
 

Private Member Functions

void buildGraph (const GroupDef *gd)
 
void addCollaborationMember (const Definition *def, QCString &url, EdgeType eType)
 
void addMemberList (class MemberList *ml)
 
void writeGraphHeader (TextStream &t, const QCString &title) const
 
EdgeaddEdge (DotNode *_pNStart, DotNode *_pNEnd, EdgeType _eType, const QCString &_label, const QCString &_url)
 

Private Attributes

DotNodem_rootNode
 
DotNodeMap m_usedNodes
 
QCString m_diskName
 
std::vector< std::unique_ptr< Edge > > m_edges
 

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 a group collaboration graph.

Definition at line 28 of file dotgroupcollaboration.h.

Member Enumeration Documentation

◆ EdgeType

Constructor & Destructor Documentation

◆ DotGroupCollaboration()

DotGroupCollaboration::DotGroupCollaboration ( const GroupDef * gd)

Definition at line 25 of file dotgroupcollaboration.cpp.

26{
27 QCString tmp_url = gd->getReference()+"$"+gd->getOutputFileBase();
28 QCString tooltip = gd->briefDescriptionAsTooltip();
29 m_rootNode = new DotNode(this, gd->groupTitle(), tooltip, tmp_url, TRUE );
30 m_rootNode->markAsVisible();
31 m_usedNodes.emplace(gd->name().str(), m_rootNode);
32
34
35 buildGraph( gd );
36}
virtual QCString briefDescriptionAsTooltip() const =0
virtual QCString getReference() const =0
virtual QCString getOutputFileBase() const =0
virtual const QCString & name() const =0
friend class DotNode
Definition dotgraph.h:36
void buildGraph(const GroupDef *gd)
virtual QCString groupTitle() const =0
const std::string & str() const
Definition qcstring.h:526
#define TRUE
Definition qcstring.h:37

References Definition::briefDescriptionAsTooltip(), buildGraph(), DotGraph::DotNode, Definition::getOutputFileBase(), Definition::getReference(), GroupDef::groupTitle(), m_diskName, m_rootNode, m_usedNodes, Definition::name(), QCString::str(), and TRUE.

◆ ~DotGroupCollaboration()

DotGroupCollaboration::~DotGroupCollaboration ( )
override

Definition at line 38 of file dotgroupcollaboration.cpp.

39{
40 // delete all created Nodes saved in m_usedNodes map
41 for (const auto &[name,node] : m_usedNodes)
42 {
43 delete node;
44 }
45}

References m_usedNodes.

Member Function Documentation

◆ addCollaborationMember()

void DotGroupCollaboration::addCollaborationMember ( const Definition * def,
QCString & url,
EdgeType eType )
private

Definition at line 186 of file dotgroupcollaboration.cpp.

188{
189 // Create group nodes
190 QCString tmp_str;
191 for (const auto &d : def->partOfGroups())
192 {
193 auto it = m_usedNodes.find(d->name().str());
194 DotNode* nnode = it!=m_usedNodes.end() ? it->second : nullptr;
195 if ( nnode != m_rootNode )
196 {
197 if ( nnode==nullptr )
198 { // add node
199 tmp_str = d->getReference()+"$"+d->getOutputFileBase();
200 QCString tooltip = d->briefDescriptionAsTooltip();
201 nnode = new DotNode(this, d->groupTitle(), tooltip, tmp_str );
202 nnode->markAsVisible();
203 m_usedNodes.emplace(d->name().str(), nnode);
204 }
205 tmp_str = def->qualifiedName();
206 addEdge( m_rootNode, nnode, eType, tmp_str, url );
207 }
208 }
209}
virtual const GroupList & partOfGroups() const =0
virtual QCString qualifiedName() const =0
Edge * addEdge(DotNode *_pNStart, DotNode *_pNEnd, EdgeType _eType, const QCString &_label, const QCString &_url)
void markAsVisible(bool b=TRUE)
Definition dotnode.h:120

References addEdge(), DotGraph::DotNode, m_rootNode, m_usedNodes, DotNode::markAsVisible(), Definition::partOfGroups(), and Definition::qualifiedName().

Referenced by addMemberList(), and buildGraph().

◆ addEdge()

DotGroupCollaboration::Edge * DotGroupCollaboration::addEdge ( DotNode * _pNStart,
DotNode * _pNEnd,
EdgeType _eType,
const QCString & _label,
const QCString & _url )
private

Definition at line 162 of file dotgroupcollaboration.cpp.

165{
166 // search a existing link.
167 auto it = std::find_if(m_edges.begin(),m_edges.end(),
168 [&_pNStart,&_pNEnd,&_eType](const auto &edge)
169 { return edge->pNStart==_pNStart && edge->pNEnd==_pNEnd && edge->eType==_eType; });
170
171 if (it==m_edges.end()) // new link
172 {
173 m_edges.emplace_back(std::make_unique<Edge>(_pNStart,_pNEnd,_eType));
174 it = m_edges.end()-1;
175 }
176
177 if (!_label.isEmpty()) // add label
178 {
179 (*it)->links.emplace_back(_label,_url);
180 }
181
182 // return found or added edge
183 return (*it).get();
184}
std::vector< std::unique_ptr< Edge > > m_edges
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150

References DotGraph::DotNode, QCString::isEmpty(), and m_edges.

Referenced by addCollaborationMember(), and buildGraph().

◆ addMemberList()

void DotGroupCollaboration::addMemberList ( class MemberList * ml)
private

Definition at line 151 of file dotgroupcollaboration.cpp.

152{
153 QCString url;
154 if ( ml==nullptr || ml->empty() ) return;
155 for (const auto &def : *ml)
156 {
157 makeURL(def,url);
159 }
160}
void addCollaborationMember(const Definition *def, QCString &url, EdgeType eType)
static void makeURL(const Definition *def, QCString &url)

References addCollaborationMember(), MemberVector::empty(), makeURL(), and tmember.

Referenced by buildGraph().

◆ buildGraph()

void DotGroupCollaboration::buildGraph ( const GroupDef * gd)
private

Definition at line 58 of file dotgroupcollaboration.cpp.

59{
60 QCString url;
61 //===========================
62 // hierarchy.
63
64 // Write parents
65 for (const auto &d : gd->partOfGroups())
66 {
67 DotNode *nnode = nullptr;
68 auto it = m_usedNodes.find(d->name().str());
69 if ( it==m_usedNodes.end())
70 { // add node
71 makeURL(d,url);
72 QCString tooltip = d->briefDescriptionAsTooltip();
73 nnode = new DotNode(this, d->groupTitle(), tooltip, url );
74 nnode->markAsVisible();
75 m_usedNodes.emplace(d->name().str(), nnode);
76 }
77 else
78 {
79 nnode = it->second;
80 }
81 url = "";
83 }
84
85 // Add subgroups
86 for (const auto &def : gd->getSubGroups())
87 {
88 DotNode *nnode = nullptr;
89 auto it = m_usedNodes.find(def->name().str());
90 if ( it==m_usedNodes.end())
91 { // add node
92 makeURL(def,url);
93 QCString tooltip = def->briefDescriptionAsTooltip();
94 nnode = new DotNode(this, def->groupTitle(), tooltip, url );
95 nnode->markAsVisible();
96 m_usedNodes.emplace(def->name().str(), nnode);
97 }
98 else
99 {
100 nnode = it->second;
101 }
102 url = "";
104 }
105
106 //=======================
107 // Write collaboration
108
109 // Add members
110 addMemberList( gd->getMemberList(MemberListType::AllMembersList()) );
111
112 // Add classes
113 for (const auto &def : gd->getClasses())
114 {
115 makeURL(def,url);
117 }
118
119 // Add namespaces
120 for (const auto &def : gd->getNamespaces())
121 {
122 makeURL(def,url);
124 }
125
126 // Add files
127 for (const auto &def : gd->getFiles())
128 {
129 makeURL(def,url);
131 }
132
133 // Add pages
134 for (const auto &def : gd->getPages())
135 {
136 makeURL(def,url);
138 }
139
140 // Add directories
141 if ( !gd->getDirs().empty() )
142 {
143 for(const auto def : gd->getDirs())
144 {
145 makeURL(def,url);
147 }
148 }
149}
void addMemberList(class MemberList *ml)
virtual const DirList & getDirs() const =0
virtual const GroupList & getSubGroups() const =0
virtual const FileList & getFiles() const =0
virtual const PageLinkedRefMap & getPages() const =0
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual MemberList * getMemberList(MemberListType lt) const =0

References addCollaborationMember(), addEdge(), addMemberList(), DotGraph::DotNode, GroupDef::getClasses(), GroupDef::getDirs(), GroupDef::getFiles(), GroupDef::getMemberList(), GroupDef::getNamespaces(), GroupDef::getPages(), GroupDef::getSubGroups(), m_rootNode, m_usedNodes, makeURL(), DotNode::markAsVisible(), Definition::partOfGroups(), tclass, tdir, tfile, thierarchy, tnamespace, and tpages.

Referenced by DotGroupCollaboration().

◆ computeTheGraph()

void DotGroupCollaboration::computeTheGraph ( )
overrideprotectedvirtual

Implements DotGraph.

Definition at line 216 of file dotgroupcollaboration.cpp.

217{
218 TextStream md5stream;
219 writeGraphHeader(md5stream,m_rootNode->label());
220
221 // clean write flags
222 for (const auto &[name,node] : m_usedNodes)
223 {
224 node->clearWriteFlag();
225 }
226
227 // write other nodes.
228 for (const auto &[name,node] : m_usedNodes)
229 {
230 node->write(md5stream,GraphType::Inheritance,m_graphFormat,TRUE,FALSE,FALSE);
231 }
232
233 // write edges
234 for (const auto &edge : m_edges)
235 {
236 edge->write( md5stream );
237 }
238
239 writeGraphFooter(md5stream);
240
241 m_theGraph = md5stream.str();
242}
static void writeGraphFooter(TextStream &t)
Definition dotgraph.cpp:301
GraphOutputFormat m_graphFormat
Definition dotgraph.h:85
QCString m_theGraph
Definition dotgraph.h:95
void writeGraphHeader(TextStream &t, const QCString &title) const
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:229
@ Inheritance
Definition dotgraph.h:31
#define FALSE
Definition qcstring.h:34

References FALSE, Inheritance, m_edges, DotGraph::m_graphFormat, m_rootNode, DotGraph::m_theGraph, m_usedNodes, TextStream::str(), TRUE, DotGraph::writeGraphFooter(), and writeGraphHeader().

◆ getBaseName()

QCString DotGroupCollaboration::getBaseName ( ) const
overrideprotectedvirtual

Implements DotGraph.

Definition at line 211 of file dotgroupcollaboration.cpp.

212{
213 return m_diskName;
214}

References m_diskName.

◆ getMapLabel()

QCString DotGroupCollaboration::getMapLabel ( ) const
overrideprotectedvirtual

Implements DotGraph.

Definition at line 244 of file dotgroupcollaboration.cpp.

245{
247}
QCString m_baseName
Definition dotgraph.h:94
QCString escapeCharsInString(const QCString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:3684

References escapeCharsInString(), FALSE, and DotGraph::m_baseName.

◆ isTooBig()

bool DotGroupCollaboration::isTooBig ( ) const

Definition at line 324 of file dotgroupcollaboration.cpp.

325{
326 return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES);
327}
#define Config_getInt(name)
Definition config.h:34

References Config_getInt, and numNodes().

Referenced by GroupDefImpl::writeGroupGraph().

◆ isTrivial()

bool DotGroupCollaboration::isTrivial ( ) const

Definition at line 319 of file dotgroupcollaboration.cpp.

320{
321 return m_usedNodes.size() <= 1;
322}

References m_usedNodes.

Referenced by GroupDefImpl::writeGroupGraph().

◆ numNodes()

int DotGroupCollaboration::numNodes ( ) const

Definition at line 329 of file dotgroupcollaboration.cpp.

330{
331 return static_cast<int>(m_usedNodes.size());
332}

References m_usedNodes.

Referenced by isTooBig(), and GroupDefImpl::writeGroupGraph().

◆ writeGraph()

QCString DotGroupCollaboration::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 249 of file dotgroupcollaboration.cpp.

253{
255
256 return DotGraph::writeGraph(t, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId);
257}
bool m_doNotAddImageToIndex
Definition dotgraph.h:97
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 Html, DotGraph::m_doNotAddImageToIndex, and DotGraph::writeGraph().

Referenced by DocbookGenerator::endGroupCollaboration(), HtmlGenerator::endGroupCollaboration(), and LatexGenerator::endGroupCollaboration().

◆ writeGraphHeader()

void DotGroupCollaboration::writeGraphHeader ( TextStream & t,
const QCString & title ) const
private

Definition at line 334 of file dotgroupcollaboration.cpp.

335{
337 t << " rankdir=LR;\n";
338}
static void writeGraphHeader(TextStream &t, const QCString &title=QCString())
Definition dotgraph.cpp:276

References DotGraph::writeGraphHeader().

Referenced by computeTheGraph().

Member Data Documentation

◆ m_diskName

QCString DotGroupCollaboration::m_diskName
private

Definition at line 88 of file dotgroupcollaboration.h.

Referenced by DotGroupCollaboration(), and getBaseName().

◆ m_edges

std::vector< std::unique_ptr<Edge> > DotGroupCollaboration::m_edges
private

Definition at line 89 of file dotgroupcollaboration.h.

Referenced by addEdge(), and computeTheGraph().

◆ m_rootNode

DotNode* DotGroupCollaboration::m_rootNode
private

◆ m_usedNodes

DotNodeMap DotGroupCollaboration::m_usedNodes
private

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