# t20018 - Recursive template sequence diagram test case
## Config
```yaml
compilation_database_dir: ..
output_directory: puml
diagrams:
  t20018_sequence:
    type: sequence
    glob:
      - ../../tests/t20018/t20018.cc
    include:
      namespaces:
        - clanguml::t20018
    using_namespace:
      - clanguml::t20018
    start_from:
      - function: "clanguml::t20018::tmain()"
```
## Source code
File t20018.cc
```cpp
#include <iostream>

namespace clanguml {
namespace t20018 {

template <int N> struct Factorial {
    static const int value = N * Factorial<N - 1>::value;

    static void print(int answer) { Factorial<N - 1>::print(answer); }
};

template <> struct Factorial<0> {
    static const int value = 1;

    static void print(int answer)
    {
        std::cout << "The answer is " << answer << "\n";
    }
};

template <typename T, int N = T::value> struct Answer {
    static void print() { T::print(N); }
};

void tmain() { Answer<Factorial<5>>::print(); }
}
}
```
## Generated UML diagrams
![t20018_sequence](./t20018_sequence.svg "Recursive template sequence diagram test case")
## Generated JSON models
```json
{
  "diagram_type": "sequence",
  "metadata": {
    "clang_uml_version": "0.3.5-27-g81c7ce7",
    "llvm_version": "Ubuntu clang version 15.0.6",
    "schema_version": 1
  },
  "name": "t20018_sequence",
  "participants": [
    {
      "id": "227581758025403815",
      "name": "clanguml::t20018::tmain()",
      "source_location": {
        "file": "../../tests/t20018/t20018.cc",
        "line": 25
      },
      "type": "function"
    },
    {
      "id": "1163521725351533502",
      "name": "clanguml::t20018::Answer<clanguml::t20018::Factorial<5>,120>",
      "source_location": {
        "file": "../../tests/t20018/t20018.cc",
        "line": 21
      },
      "type": "class"
    },
    {
      "id": "1482779373563849921",
      "name": "clanguml::t20018::Factorial<5>",
      "source_location": {
        "file": "../../tests/t20018/t20018.cc",
        "line": 6
      },
      "type": "class"
    },
    {
      "id": "52416404065514823",
      "name": "clanguml::t20018::Factorial<4>",
      "source_location": {
        "file": "../../tests/t20018/t20018.cc",
        "line": 6
      },
      "type": "class"
    },
    {
      "id": "1658728078296100018",
      "name": "clanguml::t20018::Factorial<3>",
      "source_location": {
        "file": "../../tests/t20018/t20018.cc",
        "line": 6
      },
      "type": "class"
    },
    {
      "id": "969903469166760124",
      "name": "clanguml::t20018::Factorial<2>",
      "source_location": {
        "file": "../../tests/t20018/t20018.cc",
        "line": 6
      },
      "type": "class"
    },
    {
      "id": "2032621198190600516",
      "name": "clanguml::t20018::Factorial<1>",
      "source_location": {
        "file": "../../tests/t20018/t20018.cc",
        "line": 6
      },
      "type": "class"
    },
    {
      "id": "1581865799666386458",
      "name": "clanguml::t20018::Factorial<0>",
      "source_location": {
        "file": "../../tests/t20018/t20018.cc",
        "line": 12
      },
      "type": "class"
    }
  ],
  "sequences": [
    {
      "messages": [
        {
          "from": {
            "activity_id": "227581758025403815",
            "activity_name": "clanguml::t20018::tmain()",
            "participant_id": "227581758025403815",
            "participant_name": "clanguml::t20018::tmain()"
          },
          "name": "print()",
          "return_type": "",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20018/t20018.cc",
            "line": 25
          },
          "to": {
            "activity_id": "1185770766239304952",
            "activity_name": "clanguml::t20018::Answer<clanguml::t20018::Factorial<5>,120>::print()",
            "participant_id": "1163521725351533502"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "1185770766239304952",
            "activity_name": "clanguml::t20018::Answer<clanguml::t20018::Factorial<5>,120>::print()",
            "participant_id": "1163521725351533502"
          },
          "name": "print(int)",
          "return_type": "",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20018/t20018.cc",
            "line": 22
          },
          "to": {
            "activity_id": "833100888453299461",
            "activity_name": "clanguml::t20018::Factorial<5>::print(int)",
            "participant_id": "1482779373563849921"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "833100888453299461",
            "activity_name": "clanguml::t20018::Factorial<5>::print(int)",
            "participant_id": "1482779373563849921"
          },
          "name": "print(int)",
          "return_type": "",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20018/t20018.cc",
            "line": 9
          },
          "to": {
            "activity_id": "1782586643813991247",
            "activity_name": "clanguml::t20018::Factorial<4>::print(int)",
            "participant_id": "52416404065514823"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "1782586643813991247",
            "activity_name": "clanguml::t20018::Factorial<4>::print(int)",
            "participant_id": "52416404065514823"
          },
          "name": "print(int)",
          "return_type": "",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20018/t20018.cc",
            "line": 9
          },
          "to": {
            "activity_id": "1238078028595736678",
            "activity_name": "clanguml::t20018::Factorial<3>::print(int)",
            "participant_id": "1658728078296100018"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "1238078028595736678",
            "activity_name": "clanguml::t20018::Factorial<3>::print(int)",
            "participant_id": "1658728078296100018"
          },
          "name": "print(int)",
          "return_type": "",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20018/t20018.cc",
            "line": 9
          },
          "to": {
            "activity_id": "2163270950475476780",
            "activity_name": "clanguml::t20018::Factorial<2>::print(int)",
            "participant_id": "969903469166760124"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "2163270950475476780",
            "activity_name": "clanguml::t20018::Factorial<2>::print(int)",
            "participant_id": "969903469166760124"
          },
          "name": "print(int)",
          "return_type": "",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20018/t20018.cc",
            "line": 9
          },
          "to": {
            "activity_id": "501166016325937670",
            "activity_name": "clanguml::t20018::Factorial<1>::print(int)",
            "participant_id": "2032621198190600516"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "501166016325937670",
            "activity_name": "clanguml::t20018::Factorial<1>::print(int)",
            "participant_id": "2032621198190600516"
          },
          "name": "print(int)",
          "return_type": "",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20018/t20018.cc",
            "line": 9
          },
          "to": {
            "activity_id": "577232827352391544",
            "activity_name": "clanguml::t20018::Factorial<0>::print(int)",
            "participant_id": "1581865799666386458"
          },
          "type": "message"
        }
      ],
      "start_from": {
        "id": 227581758025403815,
        "location": "clanguml::t20018::tmain()"
      }
    }
  ],
  "using_namespace": "clanguml::t20018"
}
```
