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 28 of file dotgroupcollaboration.cpp.

29{
30 DString tmp_url = gd->getReference()+"$"+gd->getOutputFileBase();
31 DString tooltip = gd->briefDescriptionAsTooltip();
32 m_rootNode = new DotNode(this, gd->groupTitle(), tooltip, tmp_url, true );
34 m_usedNodes.emplace(gd->name().str(), m_rootNode);
35
37
38 buildGraph( gd );
39}
const std::string & str() const
Definition dstring.h:649
virtual const DString & name() const =0
virtual DString briefDescriptionAsTooltip() const =0
virtual DString getReference() const =0
virtual DString getOutputFileBase() const =0
void buildGraph(const GroupDef *gd)
void markAsVisible(bool b=true)
Definition dotnode.h:120
DotNode(DotGraph *graph, const DString &lab, const DString &tip, const DString &url, bool rootNode=false, const ClassDef *cd=nullptr)
Definition dotnode.cpp:326
virtual DString groupTitle() const =0

References Definition::briefDescriptionAsTooltip(), buildGraph(), DotNode::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 41 of file dotgroupcollaboration.cpp.

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

References m_usedNodes.

Member Function Documentation

◆ addCollaborationMember()

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

Definition at line 189 of file dotgroupcollaboration.cpp.

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

References addEdge(), DotGraph::DotNode, DotNode::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 165 of file dotgroupcollaboration.cpp.

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

155{
156 DString url;
157 if ( ml==nullptr || ml->empty() ) return;
158 for (const auto &def : *ml)
159 {
160 makeURL(def,url);
162 }
163}
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 61 of file dotgroupcollaboration.cpp.

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

220{
221 TextStream md5stream;
222 writeGraphHeader(md5stream,m_rootNode->label());
223
224 // clean write flags
225 for (const auto &[name,node] : m_usedNodes)
226 {
227 node->clearWriteFlag();
228 }
229
230 // write other nodes.
231 for (const auto &[name,node] : m_usedNodes)
232 {
233 node->write(md5stream,GraphType::Inheritance,m_graphFormat,true,false,false);
234 }
235
236 // write edges
237 for (const auto &edge : m_edges)
238 {
239 edge->write( md5stream );
240 }
241
242 writeGraphFooter(md5stream);
243
244 m_theGraph = md5stream.str();
245}
DString m_theGraph
Definition dotgraph.h:95
static void writeGraphFooter(TextStream &t)
Definition dotgraph.cpp:294
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 214 of file dotgroupcollaboration.cpp.

215{
216 return m_diskName;
217}

References m_diskName.

◆ getMapLabel()

DString DotGroupCollaboration::getMapLabel ( ) const
overrideprotectedvirtual

Implements DotGraph.

Definition at line 247 of file dotgroupcollaboration.cpp.

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

References escapeCharsInString(), and DotGraph::m_baseName.

◆ isTooBig()

bool DotGroupCollaboration::isTooBig ( ) const

Definition at line 327 of file dotgroupcollaboration.cpp.

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

323{
324 return m_usedNodes.size() <= 1;
325}

References m_usedNodes.

Referenced by GroupDefImpl::writeGroupGraph().

◆ numNodes()

int DotGroupCollaboration::numNodes ( ) const

Definition at line 332 of file dotgroupcollaboration.cpp.

333{
334 return static_cast<int>(m_usedNodes.size());
335}

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 252 of file dotgroupcollaboration.cpp.

256{
258
259 return DotGraph::writeGraph(t, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId);
260}
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:114

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 337 of file dotgroupcollaboration.cpp.

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

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: