Files
clang-uml/docs/test_cases/t20026.md
2023-08-31 23:43:57 +02:00

2.6 KiB

t20026 - Virtual method call sequence diagram test case

Config

compilation_database_dir: ..
output_directory: puml
diagrams:
  t20026_sequence:
    type: sequence
    glob:
      - ../../tests/t20026/t20026.cc
    include:
      namespaces:
        - clanguml::t20026
    using_namespace:
      - clanguml::t20026
    from:
      - function: "clanguml::t20026::tmain()"

Source code

File t20026.cc

namespace clanguml {
namespace t20026 {

struct A {
    virtual void a() { }
};

struct B : public A {
    void a() override { }
};

struct C : public B {
    void a() override { }
};

int tmain()
{
    C *a{};

    dynamic_cast<A *>(a)->a();

    return 0;
}
}
}

Generated UML diagrams

t20026_sequence

Generated JSON models

{
  "diagram_type": "sequence",
  "metadata": {
    "clang_uml_version": "0.3.8-32-ge830195",
    "llvm_version": "Ubuntu clang version 15.0.7",
    "schema_version": 1
  },
  "name": "t20026_sequence",
  "participants": [
    {
      "id": "2268697350307997040",
      "name": "clanguml::t20026::tmain()",
      "source_location": {
        "column": 5,
        "file": "../../tests/t20026/t20026.cc",
        "line": 16,
        "translation_unit": "../../tests/t20026/t20026.cc"
      },
      "type": "function"
    },
    {
      "id": "1962121823853291899",
      "name": "clanguml::t20026::A",
      "source_location": {
        "column": 8,
        "file": "../../tests/t20026/t20026.cc",
        "line": 4,
        "translation_unit": "../../tests/t20026/t20026.cc"
      },
      "type": "class"
    }
  ],
  "sequences": [
    {
      "messages": [
        {
          "from": {
            "activity_id": "2268697350307997040",
            "activity_name": "clanguml::t20026::tmain()",
            "participant_id": "2268697350307997040",
            "participant_name": "clanguml::t20026::tmain()"
          },
          "name": "a()",
          "return_type": "void",
          "scope": "normal",
          "source_location": {
            "column": 5,
            "file": "../../tests/t20026/t20026.cc",
            "line": 20,
            "translation_unit": "../../tests/t20026/t20026.cc"
          },
          "to": {
            "activity_id": "600590770418147864",
            "activity_name": "clanguml::t20026::A::a()",
            "participant_id": "1962121823853291899"
          },
          "type": "message"
        }
      ],
      "start_from": {
        "id": 2268697350307997040,
        "location": "clanguml::t20026::tmain()"
      }
    }
  ],
  "using_namespace": "clanguml::t20026"
}