13 KiB
13 KiB
t20021 - Loop statements sequence diagram test case
Config
compilation_database_dir: ..
output_directory: puml
diagrams:
t20021_sequence:
type: sequence
glob:
- ../../tests/t20021/t20021.cc
include:
namespaces:
- clanguml::t20021
using_namespace:
- clanguml::t20021
start_from:
- function: "clanguml::t20021::tmain()"
Source code
File t20021.cc
#include <vector>
namespace clanguml {
namespace t20021 {
struct A {
int a1() { return 0; }
int a2() { return 1; }
int a3() { return 2; }
};
struct B {
void log() { }
int b1() const { return 3; }
int b2() const { return 4; }
};
struct C {
int c1() { return 1; }
int c2() { return 2; }
int c3() { return 3; }
int c4() { return c5(); }
int c5() { return 5; }
std::vector<int> &contents() { return contents_; }
std::vector<int> contents_;
};
int tmain()
{
A a;
std::vector<B> b;
C c;
int i = 10;
while (i -= c.c4()) {
int j = a.a3();
do {
for (int l = a.a2(); l > c.c1(); l -= c.c2())
a.a1();
} while (j -= c.c3());
}
int result = 0;
for (const auto &bi : b) {
result += bi.b2();
}
for (const auto &ci : c.contents()) {
result += ci;
}
return b.front().b2() + result;
}
}
}
Generated UML diagrams
Generated JSON models
{
"diagram_type": "sequence",
"metadata": {
"clang_uml_version": "0.3.5-27-g81c7ce7",
"llvm_version": "Ubuntu clang version 15.0.6",
"schema_version": 1
},
"name": "t20021_sequence",
"participants": [
{
"id": "1682631020380557915",
"name": "clanguml::t20021::tmain()",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 30
},
"type": "function"
},
{
"id": "451128000259357438",
"name": "clanguml::t20021::C",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 18
},
"type": "class"
},
{
"id": "1280483607329510730",
"name": "clanguml::t20021::A",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 5
},
"type": "class"
},
{
"id": "1849696080443395393",
"name": "clanguml::t20021::B",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 11
},
"type": "class"
}
],
"sequences": [
{
"messages": [
{
"activity_id": "1682631020380557915",
"messages": [
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "c4()",
"return_type": "int",
"scope": "condition",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 37
},
"to": {
"activity_id": "124927877622321176",
"activity_name": "clanguml::t20021::C::c4()",
"participant_id": "451128000259357438"
},
"type": "message"
},
{
"from": {
"activity_id": "124927877622321176",
"activity_name": "clanguml::t20021::C::c4()",
"participant_id": "451128000259357438"
},
"name": "c5()",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 22
},
"to": {
"activity_id": "1325720714179808628",
"activity_name": "clanguml::t20021::C::c5()",
"participant_id": "451128000259357438"
},
"type": "message"
},
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "a3()",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 38
},
"to": {
"activity_id": "1867955233624891190",
"activity_name": "clanguml::t20021::A::a3()",
"participant_id": "1280483607329510730"
},
"type": "message"
},
{
"activity_id": "1682631020380557915",
"messages": [
{
"activity_id": "1682631020380557915",
"messages": [
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "a2()",
"return_type": "int",
"scope": "condition",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 40
},
"to": {
"activity_id": "1139294797758415018",
"activity_name": "clanguml::t20021::A::a2()",
"participant_id": "1280483607329510730"
},
"type": "message"
},
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "c1()",
"return_type": "int",
"scope": "condition",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 40
},
"to": {
"activity_id": "2143764740072323303",
"activity_name": "clanguml::t20021::C::c1()",
"participant_id": "451128000259357438"
},
"type": "message"
},
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "c2()",
"return_type": "int",
"scope": "condition",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 40
},
"to": {
"activity_id": "1707693479408501017",
"activity_name": "clanguml::t20021::C::c2()",
"participant_id": "451128000259357438"
},
"type": "message"
},
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "a1()",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 41
},
"to": {
"activity_id": "1659488549696810992",
"activity_name": "clanguml::t20021::A::a1()",
"participant_id": "1280483607329510730"
},
"type": "message"
}
],
"name": "for",
"type": "loop"
},
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "c3()",
"return_type": "int",
"scope": "condition",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 42
},
"to": {
"activity_id": "1302892753246800390",
"activity_name": "clanguml::t20021::C::c3()",
"participant_id": "451128000259357438"
},
"type": "message"
}
],
"name": "do",
"type": "loop"
}
],
"name": "while",
"type": "loop"
},
{
"activity_id": "1682631020380557915",
"messages": [
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "b2()",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 47
},
"to": {
"activity_id": "1387752719733375782",
"activity_name": "clanguml::t20021::B::b2()",
"participant_id": "1849696080443395393"
},
"type": "message"
}
],
"name": "for",
"type": "loop"
},
{
"activity_id": "1682631020380557915",
"messages": [
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "contents()",
"return_type": "std::vector<int> &",
"scope": "condition",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 50
},
"to": {
"activity_id": "814405216385697964",
"activity_name": "clanguml::t20021::C::contents()",
"participant_id": "451128000259357438"
},
"type": "message"
}
],
"name": "for",
"type": "loop"
},
{
"from": {
"activity_id": "1682631020380557915",
"activity_name": "clanguml::t20021::tmain()",
"participant_id": "1682631020380557915",
"participant_name": "clanguml::t20021::tmain()"
},
"name": "b2()",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20021/t20021.cc",
"line": 54
},
"to": {
"activity_id": "1387752719733375782",
"activity_name": "clanguml::t20021::B::b2()",
"participant_id": "1849696080443395393"
},
"type": "message"
}
],
"start_from": {
"id": 1682631020380557915,
"location": "clanguml::t20021::tmain()"
}
}
],
"using_namespace": "clanguml::t20021"
}