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

Representation of a group collaboration graph. More...

#include <src/dotgroupcollaboration.h>

Inheritance diagram for DotGroupCollaboration:
Collaboration diagram for DotGroupCollaboration:

Classes

struct  Edge

Public Member Functions

 DotGroupCollaboration (const GroupDef *gd)
 ~DotGroupCollaboration () override
DString writeGraph (TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const DString &path, const DString &fileName, const DString &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

DString getBaseName () const override
DString getMapLabel () const override
void computeTheGraph () override
Protected Member Functions inherited from DotGraph
int getNextNodeNumber ()
 returns the node number.
int getNextEdgeNumber ()
 returns the edge number.
DString writeGraph (TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const DString &path, const DString &fileName, const DString &relPath, bool writeImageMap=true, int graphId=-1)
virtual DString absMapName () const
virtual DString getImgAltText () const
DString absBaseName () const
DString absDotName () const
DString imgName () const
DString absImgName () const
DString 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, DString &url, EdgeType eType)
void addMemberList (class MemberList *ml)
void writeGraphHeader (TextStream &t, const DString &title) const
EdgeaddEdge (DotNode *_pNStart, DotNode *_pNEnd, EdgeType _eType, const DString &_label, const DString &_url)

Private Attributes

DotNodem_rootNode
DotNodeMap m_usedNodes
DString 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 DString &title=DString())
static void writeGraphFooter (TextStream &t)
static void computeGraph (DotNode *root, GraphType gt, GraphOutputFormat format, const DString &rank, bool renderParents, bool backArrows, const DString &title, DString &graphStr)
Protected Attributes inherited from DotGraph
GraphOutputFormat m_graphFormat = GraphOutputFormat::BITMAP
EmbeddedOutputFormat m_textFormat = EmbeddedOutputFormat::Html
Dir m_dir
DString m_fileName
DString m_relPath
bool m_generateImageMap = false
int m_graphId = 0
DString m_absPath
DString m_baseName
DString 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 29 of file dotgroupcollaboration.h.

Member Enumeration Documentation

◆ EdgeType

Constructor & Destructor Documentation

◆ DotGroupCollaboration()

DotGroupCollaboration::DotGroupCollaboration ( const GroupDef * gd)

Definition at line 30 of file dotgroupcollaboration.cpp.

31{
32 DString tmp_url = gd->getReference()+"$"+gd->getOutputFileBase();
33 DString tooltip = gd->briefDescriptionAsTooltip();
34 m_rootNode = new DotNode(this, gd->groupTitle(), tooltip, tmp_url, true );
36 m_usedNodes.emplace(gd->name().str(), m_rootNode);
37
39
40 buildGraph( gd );
41}
const std::string & str() const
Definition dstring.h:645
virtual const DString & name() const =0
virtual DString briefDescriptionAsTooltip() const =0
virtual DString getReference() const =0
virtual DString getOutputFileBase() const =0
friend class DotNode
Definition dotgraph.h:36
void buildGraph(const GroupDef *gd)
void markAsVisible(bool b=true)
Definition dotnode.h:120
virtual DString groupTitle() const =0

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

◆ ~DotGroupCollaboration()

DotGroupCollaboration::~DotGroupCollaboration ( )
override

Definition at line 43 of file dotgroupcollaboration.cpp.

44{
45 // delete all created Nodes saved in m_usedNodes map
46 for (const auto &[name,node] : m_usedNodes)
47 {
48 delete node;
49 }
50}

References m_usedNodes.

Member Function Documentation

◆ addCollaborationMember()

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

Definition at line 191 of file dotgroupcollaboration.cpp.

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

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 DString & _label,
const DString & _url )
private

Definition at line 167 of file dotgroupcollaboration.cpp.

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

References DotGraph::DotNode, DString::empty(), and m_edges.

Referenced by addCollaborationMember(), and buildGraph().

◆ addMemberList()

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

Definition at line 156 of file dotgroupcollaboration.cpp.

157{
158 DString url;
159 if ( ml==nullptr || ml->empty() ) return;
160 for (const auto &def : *ml)
161 {
162 makeURL(def,url);
164 }
165}
void addCollaborationMember(const Definition *def, DString &url, EdgeType eType)
static void makeURL(const Definition *def, DString &url)

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

Referenced by buildGraph().

◆ buildGraph()

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

Definition at line 63 of file dotgroupcollaboration.cpp.

64{
65 DString url;
66 //===========================
67 // hierarchy.
68
69 // Write parents
70 for (const auto &d : gd->partOfGroups())
71 {
72 DotNode *nnode = nullptr;
73 auto it = m_usedNodes.find(d->name().str());
74 if ( it==m_usedNodes.end())
75 { // add node
76 makeURL(d,url);
77 DString tooltip = d->briefDescriptionAsTooltip();
78 nnode = new DotNode(this, d->groupTitle(), tooltip, url );
79 nnode->markAsVisible();
80 m_usedNodes.emplace(d->name().str(), nnode);
81 }
82 else
83 {
84 nnode = it->second;
85 }
86 url = "";
88 }
89
90 // Add subgroups
91 for (const auto &def : gd->getSubGroups())
92 {
93 DotNode *nnode = nullptr;
94 auto it = m_usedNodes.find(def->name().str());
95 if ( it==m_usedNodes.end())
96 { // add node
97 makeURL(def,url);
98 DString tooltip = def->briefDescriptionAsTooltip();
99 nnode = new DotNode(this, def->groupTitle(), tooltip, url );
100 nnode->markAsVisible();
101 m_usedNodes.emplace(def->name().str(), nnode);
102 }
103 else
104 {
105 nnode = it->second;
106 }
107 url = "";
109 }
110
111 //=======================
112 // Write collaboration
113
114 // Add members
115 addMemberList( gd->getMemberList(MemberListType::AllMembersList()) );
116
117 // Add classes
118 for (const auto &def : gd->getClasses())
119 {
120 makeURL(def,url);
122 }
123
124 // Add namespaces
125 for (const auto &def : gd->getNamespaces())
126 {
127 makeURL(def,url);
129 }
130
131 // Add files
132 for (const auto &def : gd->getFiles())
133 {
134 makeURL(def,url);
136 }
137
138 // Add pages
139 for (const auto &def : gd->getPages())
140 {
141 makeURL(def,url);
143 }
144
145 // Add directories
146 if ( !gd->getDirs().empty() )
147 {
148 for(const auto &def : gd->getDirs())
149 {
150 makeURL(def,url);
152 }
153 }
154}
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 221 of file dotgroupcollaboration.cpp.

222{
223 TextStream md5stream;
224 writeGraphHeader(md5stream,m_rootNode->label());
225
226 // clean write flags
227 for (const auto &[name,node] : m_usedNodes)
228 {
229 node->clearWriteFlag();
230 }
231
232 // write other nodes.
233 for (const auto &[name,node] : m_usedNodes)
234 {
235 node->write(md5stream,GraphType::Inheritance,m_graphFormat,true,false,false);
236 }
237
238 // write edges
239 for (const auto &edge : m_edges)
240 {
241 edge->write( md5stream );
242 }
243
244 writeGraphFooter(md5stream);
245
246 m_theGraph = md5stream.str();
247}
DString m_theGraph
Definition dotgraph.h:95
static void writeGraphFooter(TextStream &t)
Definition dotgraph.cpp:295
GraphOutputFormat m_graphFormat
Definition dotgraph.h:85
void writeGraphHeader(TextStream &t, const DString &title) const
DString label() const
Definition dotnode.h:102
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:232
@ Inheritance
Definition dotgraph.h:31

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

◆ getBaseName()

DString DotGroupCollaboration::getBaseName ( ) const
overrideprotectedvirtual

Implements DotGraph.

Definition at line 216 of file dotgroupcollaboration.cpp.

217{
218 return m_diskName;
219}

References m_diskName.

◆ getMapLabel()

DString DotGroupCollaboration::getMapLabel ( ) const
overrideprotectedvirtual

Implements DotGraph.

Definition at line 249 of file dotgroupcollaboration.cpp.

250{
251 return escapeCharsInString(m_baseName, false);
252}
DString m_baseName
Definition dotgraph.h:94
DString escapeCharsInString(const DString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:2688

References escapeCharsInString(), and DotGraph::m_baseName.

◆ isTooBig()

bool DotGroupCollaboration::isTooBig ( ) const

Definition at line 329 of file dotgroupcollaboration.cpp.

330{
331 return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES);
332}
#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 324 of file dotgroupcollaboration.cpp.

325{
326 return m_usedNodes.size() <= 1;
327}

References m_usedNodes.

Referenced by GroupDefImpl::writeGroupGraph().

◆ numNodes()

int DotGroupCollaboration::numNodes ( ) const

Definition at line 334 of file dotgroupcollaboration.cpp.

335{
336 return static_cast<int>(m_usedNodes.size());
337}

References m_usedNodes.

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

◆ writeGraph()

DString DotGroupCollaboration::writeGraph ( TextStream & t,
GraphOutputFormat gf,
EmbeddedOutputFormat ef,
const DString & path,
const DString & fileName,
const DString & relPath,
bool writeImageMap = true,
int graphId = -1 )

Definition at line 254 of file dotgroupcollaboration.cpp.

258{
260
261 return DotGraph::writeGraph(t, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId);
262}
bool m_doNotAddImageToIndex
Definition dotgraph.h:97
DString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const DString &path, const DString &fileName, const DString &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 DString & title ) const
private

Definition at line 339 of file dotgroupcollaboration.cpp.

340{
342 t << " rankdir=LR;\n";
343}
static void writeGraphHeader(TextStream &t, const DString &title=DString())
Definition dotgraph.cpp:270

References DotGraph::writeGraphHeader().

Referenced by computeTheGraph().

Member Data Documentation

◆ m_diskName

DString DotGroupCollaboration::m_diskName
private

Definition at line 89 of file dotgroupcollaboration.h.

Referenced by DotGroupCollaboration(), and getBaseName().

◆ m_edges

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

Definition at line 90 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: