Files
clang-uml/docs/test_cases/t20016.md
2023-10-08 17:24:30 +02:00

200 lines
5.5 KiB
Markdown

# t20016 - Template method specialization sequence diagram test case
## Config
```yaml
compilation_database_dir: ..
output_directory: diagrams
diagrams:
t20016_sequence:
type: sequence
glob:
- ../../tests/t20016/t20016.cc
include:
namespaces:
- clanguml::t20016
using_namespace:
- clanguml::t20016
from:
- function: "clanguml::t20016::tmain()"
```
## Source code
File t20016.cc
```cpp
namespace clanguml {
namespace t20016 {
struct A {
void a1(int a) { }
template <typename T> T a2(const T &a) { return a; }
};
template <typename T> struct B {
void b1(T b) { a_.a1(1); }
template <typename F> F b2(T t) { return a_.a2(t); }
A a_;
};
void tmain()
{
B<long> b;
b.b1(1);
b.b2<int>(2);
}
}
}
```
## Generated PlantUML diagrams
![t20016_sequence](./t20016_sequence.svg "Template method specialization sequence diagram test case")
## Generated Mermaid diagrams
![t20016_sequence](./t20016_sequence_mermaid.svg "Template method specialization sequence diagram test case")
## Generated JSON models
```json
{
"diagram_type": "sequence",
"metadata": {
"clang_uml_version": "0.4.0-2-g4ab0d29",
"llvm_version": "Ubuntu clang version 16.0.6 (++20230710042027+7cbf1a259152-1~exp1~20230710162048.105)",
"schema_version": 1
},
"name": "t20016_sequence",
"participants": [
{
"id": "1912662358651926712",
"name": "clanguml::t20016::tmain()",
"source_location": {
"column": 6,
"file": "../../tests/t20016/t20016.cc",
"line": 16,
"translation_unit": "../../tests/t20016/t20016.cc"
},
"type": "function"
},
{
"id": "1688340912643326666",
"name": "clanguml::t20016::B<long>",
"source_location": {
"column": 30,
"file": "../../tests/t20016/t20016.cc",
"line": 8,
"translation_unit": "../../tests/t20016/t20016.cc"
},
"type": "class"
},
{
"id": "1351242594275053195",
"name": "clanguml::t20016::A",
"source_location": {
"column": 8,
"file": "../../tests/t20016/t20016.cc",
"line": 3,
"translation_unit": "../../tests/t20016/t20016.cc"
},
"type": "class"
}
],
"sequences": [
{
"messages": [
{
"from": {
"activity_id": "1912662358651926712",
"activity_name": "clanguml::t20016::tmain()",
"participant_id": "1912662358651926712",
"participant_name": "clanguml::t20016::tmain()"
},
"name": "b1(long)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 5,
"file": "../../tests/t20016/t20016.cc",
"line": 20,
"translation_unit": "../../tests/t20016/t20016.cc"
},
"to": {
"activity_id": "2064264710178722261",
"activity_name": "clanguml::t20016::B<long>::b1(long)",
"participant_id": "1688340912643326666"
},
"type": "message"
},
{
"from": {
"activity_id": "2064264710178722261",
"activity_name": "clanguml::t20016::B<long>::b1(long)",
"participant_id": "1688340912643326666"
},
"name": "a1(int)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 20,
"file": "../../tests/t20016/t20016.cc",
"line": 9,
"translation_unit": "../../tests/t20016/t20016.cc"
},
"to": {
"activity_id": "1198371121423942542",
"activity_name": "clanguml::t20016::A::a1(int)",
"participant_id": "1351242594275053195"
},
"type": "message"
},
{
"from": {
"activity_id": "1912662358651926712",
"activity_name": "clanguml::t20016::tmain()",
"participant_id": "1912662358651926712",
"participant_name": "clanguml::t20016::tmain()"
},
"name": "b2(long)",
"return_type": "F",
"scope": "normal",
"source_location": {
"column": 5,
"file": "../../tests/t20016/t20016.cc",
"line": 22,
"translation_unit": "../../tests/t20016/t20016.cc"
},
"to": {
"activity_id": "203381140188081853",
"activity_name": "clanguml::t20016::B<long>::b2(long)",
"participant_id": "1688340912643326666"
},
"type": "message"
},
{
"from": {
"activity_id": "203381140188081853",
"activity_name": "clanguml::t20016::B<long>::b2(long)",
"participant_id": "1688340912643326666"
},
"name": "a2(const long &)",
"return_type": "long",
"scope": "normal",
"source_location": {
"column": 46,
"file": "../../tests/t20016/t20016.cc",
"line": 11,
"translation_unit": "../../tests/t20016/t20016.cc"
},
"to": {
"activity_id": "1208784669530380166",
"activity_name": "clanguml::t20016::A::a2(const long &)",
"participant_id": "1351242594275053195"
},
"type": "message"
}
],
"start_from": {
"id": 1912662358651926712,
"location": "clanguml::t20016::tmain()"
}
}
],
"using_namespace": "clanguml::t20016"
}
```