Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
0944fd88
Commit
0944fd88
authored
7 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
allow creation of graphs containing only the modules
parent
f0fc9e81
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/EntityOwner.h
+9
-2
9 additions, 2 deletions
include/EntityOwner.h
src/EntityOwner.cc
+31
-17
31 additions, 17 deletions
src/EntityOwner.cc
with
40 additions
and
19 deletions
include/EntityOwner.h
+
9
−
2
View file @
0944fd88
...
...
@@ -113,9 +113,16 @@ namespace ChimeraTK {
/** Print the full hierarchy to stdout. */
void
dump
(
const
std
::
string
&
prefix
=
""
)
const
;
/** Create Graphviz dot graph write to file */
/** Create Graphviz dot graph and write to file. The graph will contain the full hierarchy of modules and
* variables below (and including) this module. Each variable will also show which tags are attached to it.
* ModuleGroups will be drawn with a double line, ApplicationModules with a bold line. Hierarchies which will
* be eliminated in the dynamic information model are shown with a dotted line. */
void
dumpGraph
(
const
std
::
string
&
fileName
=
"graph.dot"
)
const
;
/** Create a Graphiz dot graph similar to the one created with dumpGraph, but just show the modules and not the
* variables. This allows to get an overview over more complex applications. */
void
dumpModuleGraph
(
const
std
::
string
&
fileName
=
"graph.dot"
)
const
;
enum
class
ModuleType
{
ApplicationModule
,
ModuleGroup
,
VariableGroup
,
ControlSystem
,
Device
};
...
...
@@ -132,7 +139,7 @@ namespace ChimeraTK {
bool
eliminateFirstHierarchy
=
false
,
bool
negate
=
false
)
const
;
/** Create Graphviz dot graph write to stream, excluding the surrounding digraph command */
void
dumpGraphInternal
(
std
::
ostream
&
stream
)
const
;
void
dumpGraphInternal
(
std
::
ostream
&
stream
,
bool
showVariables
)
const
;
/** Clean a fully qualified entity name so it can be used as a dot node name (i.e. strip slashes etc.) */
std
::
string
cleanDotNode
(
std
::
string
fullName
)
const
;
...
...
This diff is collapsed.
Click to expand it.
src/EntityOwner.cc
+
31
−
17
View file @
0944fd88
...
...
@@ -177,7 +177,17 @@ namespace ChimeraTK {
void
EntityOwner
::
dumpGraph
(
const
std
::
string
&
fileName
)
const
{
std
::
fstream
file
(
fileName
,
std
::
ios_base
::
out
);
file
<<
"digraph G {"
<<
std
::
endl
;
dumpGraphInternal
(
file
);
dumpGraphInternal
(
file
,
true
);
file
<<
"}"
<<
std
::
endl
;
file
.
close
();
}
/*********************************************************************************************************************/
void
EntityOwner
::
dumpModuleGraph
(
const
std
::
string
&
fileName
)
const
{
std
::
fstream
file
(
fileName
,
std
::
ios_base
::
out
);
file
<<
"digraph G {"
<<
std
::
endl
;
dumpGraphInternal
(
file
,
false
);
file
<<
"}"
<<
std
::
endl
;
file
.
close
();
}
...
...
@@ -192,7 +202,7 @@ namespace ChimeraTK {
/*********************************************************************************************************************/
void
EntityOwner
::
dumpGraphInternal
(
std
::
ostream
&
stream
)
const
{
void
EntityOwner
::
dumpGraphInternal
(
std
::
ostream
&
stream
,
bool
showVariables
)
const
{
std
::
string
myDotNode
=
cleanDotNode
(
getQualifiedName
());
...
...
@@ -208,27 +218,31 @@ namespace ChimeraTK {
}
stream
<<
"]"
<<
std
::
endl
;
for
(
auto
&
node
:
getAccessorList
())
{
std
::
string
dotNode
=
cleanDotNode
(
node
.
getQualifiedName
());
stream
<<
dotNode
<<
"[label=
\"
{"
<<
node
.
getName
()
<<
"| {"
;
bool
first
=
true
;
for
(
auto
tag
:
node
.
getTags
())
{
if
(
!
first
)
{
stream
<<
"|"
;
if
(
showVariables
)
{
for
(
auto
&
node
:
getAccessorList
())
{
std
::
string
dotNode
=
cleanDotNode
(
node
.
getQualifiedName
());
stream
<<
dotNode
<<
"[label=
\"
{"
<<
node
.
getName
()
<<
"| {"
;
bool
first
=
true
;
for
(
auto
tag
:
node
.
getTags
())
{
if
(
!
first
)
{
stream
<<
"|"
;
}
else
{
first
=
false
;
}
stream
<<
tag
;
}
else
{
first
=
false
;
}
stream
<<
tag
;
stream
<<
"}}
\"
, shape=record]"
<<
std
::
endl
;
stream
<<
" "
<<
myDotNode
<<
" -> "
<<
dotNode
<<
std
::
endl
;
}
stream
<<
"}}
\"
, shape=record]"
<<
std
::
endl
;
stream
<<
" "
<<
myDotNode
<<
" -> "
<<
dotNode
<<
std
::
endl
;
}
for
(
auto
&
submodule
:
getSubmoduleList
())
{
for
(
auto
submodule
:
getSubmoduleList
())
{
if
(
submodule
->
getModuleType
()
==
ModuleType
::
Device
||
submodule
->
getModuleType
()
==
ModuleType
::
ControlSystem
)
continue
;
std
::
string
dotNode
=
cleanDotNode
(
submodule
->
getQualifiedName
());
stream
<<
" "
<<
myDotNode
<<
" -> "
<<
dotNode
<<
std
::
endl
;
submodule
->
dumpGraphInternal
(
stream
);
submodule
->
dumpGraphInternal
(
stream
,
showVariables
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment