compilation_database_dir: ..
output_directory: diagrams
add_compile_flags:
- -fparse-all-comments
diagrams:
t20001_sequence:
type: sequence
title: Basic sequence diagram example
glob:
- ../../tests/t20001/t20001.cc
include:
namespaces:
- clanguml::t20001
exclude:
namespaces:
- clanguml::t20001::detail
using_namespace:
- clanguml::t20001
from:
- function: "clanguml::t20001::tmain()"
plantuml:
before:
- "' t20001 test diagram of type {{ diagram.type }}"
after:
- '{% set e=element("clanguml::t20001::tmain()") %} note over {{ e.alias) }}: Main test function'
mermaid:
before:
- "%% t20001 test diagram of type {{ diagram.type }}"
after:
- '{% set e=element("clanguml::t20001::tmain()") %} Note over {{ e.alias) }}: Main test function'
File t20001.cc
#include <algorithm>
#include <vector>
namespace clanguml {
namespace t20001 {
namespace detail {
struct C {
auto add(int x, int y) { return x + y; }
};
}
class A {
public:
A() { }
int add(int x, int y) { return m_c.add(x, y); }
int add3(int x, int y, int z)
{
std::vector<int> v;
v.push_back(x);
v.push_back(y);
v.push_back(z);
auto res = add(v[0], v[1]) + v[2];
log_result(res);
return res;
}
static void log_result(int r) { }
private:
detail::C m_c{};
};
class B {
public:
B(A &a)
: m_a{a}
{
}
int wrap_add(int x, int y)
{
auto res = m_a.add(x, y);
m_a.log_result(res);
return res;
}
int wrap_add3(int x, int y, int z)
{
auto res = m_a.add3(x, y, z);
m_a.log_result(res);
return res;
}
private:
A &m_a;
};
int tmain()
{
A a;
B b(a);
// \uml{note Just add 2 numbers}
auto tmp = a.add(1, 2);
// \uml{note[] And now add another 2}
return b.wrap_add3(tmp, 2, 3);
}
}
}
{
"diagram_type": "sequence",
"metadata": {
"clang_uml_version": "0.4.1-11-g39d3e1f",
"llvm_version": "Ubuntu clang version 16.0.6 (++20230710042027+7cbf1a259152-1~exp1~20230710162048.105)",
"schema_version": 1
},
"name": "t20001_sequence",
"participants": [
{
"id": "622672604730036140",
"name": "clanguml::t20001::tmain()",
"source_location": {
"column": 5,
"file": "../../tests/t20001/t20001.cc",
"line": 61,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"type": "function"
},
{
"id": "1771943546649183134",
"name": "clanguml::t20001::A",
"source_location": {
"column": 7,
"file": "../../tests/t20001/t20001.cc",
"line": 13,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"type": "class"
},
{
"id": "272433898507800600",
"name": "clanguml::t20001::B",
"source_location": {
"column": 7,
"file": "../../tests/t20001/t20001.cc",
"line": 36,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"type": "class"
}
],
"sequences": [
{
"messages": [
{
"from": {
"activity_id": "622672604730036140",
"activity_name": "clanguml::t20001::tmain()",
"participant_id": "622672604730036140",
"participant_name": "clanguml::t20001::tmain()"
},
"name": "A()",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 7,
"file": "../../tests/t20001/t20001.cc",
"line": 63,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"to": {
"activity_id": "275353461034438145",
"activity_name": "clanguml::t20001::A::A()",
"participant_id": "1771943546649183134"
},
"type": "message"
},
{
"from": {
"activity_id": "622672604730036140",
"activity_name": "clanguml::t20001::tmain()",
"participant_id": "622672604730036140",
"participant_name": "clanguml::t20001::tmain()"
},
"name": "B(A &)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 7,
"file": "../../tests/t20001/t20001.cc",
"line": 64,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"to": {
"activity_id": "2235477658795500000",
"activity_name": "clanguml::t20001::B::B(A &)",
"participant_id": "272433898507800600"
},
"type": "message"
},
{
"comment": "\\uml{note Just add 2 numbers}",
"from": {
"activity_id": "622672604730036140",
"activity_name": "clanguml::t20001::tmain()",
"participant_id": "622672604730036140",
"participant_name": "clanguml::t20001::tmain()"
},
"name": "add(int,int)",
"return_type": "int",
"scope": "normal",
"source_location": {
"column": 16,
"file": "../../tests/t20001/t20001.cc",
"line": 67,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"to": {
"activity_id": "1131549932713395402",
"activity_name": "clanguml::t20001::A::add(int,int)",
"participant_id": "1771943546649183134"
},
"type": "message"
},
{
"comment": "\\uml{note[] And now add another 2}",
"from": {
"activity_id": "622672604730036140",
"activity_name": "clanguml::t20001::tmain()",
"participant_id": "622672604730036140",
"participant_name": "clanguml::t20001::tmain()"
},
"name": "wrap_add3(int,int,int)",
"return_type": "int",
"scope": "normal",
"source_location": {
"column": 12,
"file": "../../tests/t20001/t20001.cc",
"line": 70,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"to": {
"activity_id": "642550151323208936",
"activity_name": "clanguml::t20001::B::wrap_add3(int,int,int)",
"participant_id": "272433898507800600"
},
"type": "message"
},
{
"from": {
"activity_id": "642550151323208936",
"activity_name": "clanguml::t20001::B::wrap_add3(int,int,int)",
"participant_id": "272433898507800600"
},
"name": "add3(int,int,int)",
"return_type": "int",
"scope": "normal",
"source_location": {
"column": 20,
"file": "../../tests/t20001/t20001.cc",
"line": 52,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"to": {
"activity_id": "2090436635449419593",
"activity_name": "clanguml::t20001::A::add3(int,int,int)",
"participant_id": "1771943546649183134"
},
"type": "message"
},
{
"from": {
"activity_id": "2090436635449419593",
"activity_name": "clanguml::t20001::A::add3(int,int,int)",
"participant_id": "1771943546649183134"
},
"name": "add(int,int)",
"return_type": "int",
"scope": "normal",
"source_location": {
"column": 20,
"file": "../../tests/t20001/t20001.cc",
"line": 25,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"to": {
"activity_id": "1131549932713395402",
"activity_name": "clanguml::t20001::A::add(int,int)",
"participant_id": "1771943546649183134"
},
"type": "message"
},
{
"from": {
"activity_id": "2090436635449419593",
"activity_name": "clanguml::t20001::A::add3(int,int,int)",
"participant_id": "1771943546649183134"
},
"name": "log_result(int)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 9,
"file": "../../tests/t20001/t20001.cc",
"line": 26,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"to": {
"activity_id": "1205947631808952097",
"activity_name": "clanguml::t20001::A::log_result(int)",
"participant_id": "1771943546649183134"
},
"type": "message"
},
{
"from": {
"activity_id": "642550151323208936",
"activity_name": "clanguml::t20001::B::wrap_add3(int,int,int)",
"participant_id": "272433898507800600"
},
"name": "log_result(int)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 9,
"file": "../../tests/t20001/t20001.cc",
"line": 53,
"translation_unit": "../../tests/t20001/t20001.cc"
},
"to": {
"activity_id": "1205947631808952097",
"activity_name": "clanguml::t20001::A::log_result(int)",
"participant_id": "1771943546649183134"
},
"type": "message"
}
],
"start_from": {
"id": 622672604730036140,
"location": "clanguml::t20001::tmain()"
}
}
],
"title": "Basic sequence diagram example",
"using_namespace": "clanguml::t20001"
}