Files
clang-uml/docs/test_cases/t20009.md
2023-05-04 22:32:47 +02:00

7.0 KiB

t20009 - Smart pointer dereference call expression test case

Config

compilation_database_dir: ..
output_directory: puml
diagrams:
  t20009_sequence:
    type: sequence
    glob:
      - ../../tests/t20009/t20009.cc
    include:
      namespaces:
        - clanguml::t20009
    using_namespace:
      - clanguml::t20009
    start_from:
      - function: "clanguml::t20009::tmain()"

Source code

File t20009.cc

#include <memory>
#include <string>

namespace clanguml {
namespace t20009 {
template <typename T> struct A {
    void a(T arg) { }
};

template <typename T> struct B {
    void b(T arg) { a->a(arg); }

    std::unique_ptr<A<T>> a;
};

using BFloatPtr = std::shared_ptr<B<float>>;

void tmain()
{
    std::shared_ptr<B<std::string>> bstring;
    auto bint = std::make_unique<B<int>>();
    BFloatPtr bfloat;

    bstring->b("b");
    bint.get()->b(42);
    bfloat->b(1.0);
}
}
}

Generated UML diagrams

t20009_sequence

Generated JSON models

{
  "diagram_type": "sequence",
  "metadata": {
    "clang_uml_version": "0.3.4-28-g3eb1c47",
    "llvm_version": "Ubuntu clang version 15.0.6",
    "schema_version": 1
  },
  "name": "t20009_sequence",
  "participants": [
    {
      "id": "791066686606379857",
      "name": "clanguml::t20009::tmain()",
      "source_location": {
        "file": "../../tests/t20009/t20009.cc",
        "line": 18
      },
      "type": "function"
    },
    {
      "id": "450813573860627679",
      "name": "clanguml::t20009::B<std::string>",
      "source_location": {
        "file": "../../tests/t20009/t20009.cc",
        "line": 10
      },
      "type": "class"
    },
    {
      "id": "1197403810800583218",
      "name": "clanguml::t20009::A<std::string>",
      "source_location": {
        "file": "../../tests/t20009/t20009.cc",
        "line": 6
      },
      "type": "class"
    },
    {
      "id": "2002310682025149090",
      "name": "clanguml::t20009::B<int>",
      "source_location": {
        "file": "../../tests/t20009/t20009.cc",
        "line": 10
      },
      "type": "class"
    },
    {
      "id": "1228498754558363121",
      "name": "clanguml::t20009::A<int>",
      "source_location": {
        "file": "../../tests/t20009/t20009.cc",
        "line": 6
      },
      "type": "class"
    },
    {
      "id": "1461902328659683203",
      "name": "clanguml::t20009::B<float>",
      "source_location": {
        "file": "../../tests/t20009/t20009.cc",
        "line": 10
      },
      "type": "class"
    },
    {
      "id": "1243520246309441967",
      "name": "clanguml::t20009::A<float>",
      "source_location": {
        "file": "../../tests/t20009/t20009.cc",
        "line": 6
      },
      "type": "class"
    }
  ],
  "sequences": [
    {
      "messages": [
        {
          "from": {
            "activity_id": "791066686606379857",
            "activity_name": "clanguml::t20009::tmain()",
            "participant_id": "791066686606379857",
            "participant_name": "clanguml::t20009::tmain()"
          },
          "name": "b(std::string)",
          "return_type": "void",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20009/t20009.cc",
            "line": 24
          },
          "to": {
            "activity_id": "1960266381909090879",
            "activity_name": "clanguml::t20009::B<std::string>::b(std::string)",
            "participant_id": "450813573860627679"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "1960266381909090879",
            "activity_name": "clanguml::t20009::B<std::string>::b(std::string)",
            "participant_id": "450813573860627679"
          },
          "name": "a(std::string)",
          "return_type": "void",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20009/t20009.cc",
            "line": 11
          },
          "to": {
            "activity_id": "1716775846967761286",
            "activity_name": "clanguml::t20009::A<std::string>::a(std::string)",
            "participant_id": "1197403810800583218"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "791066686606379857",
            "activity_name": "clanguml::t20009::tmain()",
            "participant_id": "791066686606379857",
            "participant_name": "clanguml::t20009::tmain()"
          },
          "name": "b(int)",
          "return_type": "void",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20009/t20009.cc",
            "line": 25
          },
          "to": {
            "activity_id": "660557928399203634",
            "activity_name": "clanguml::t20009::B<int>::b(int)",
            "participant_id": "2002310682025149090"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "660557928399203634",
            "activity_name": "clanguml::t20009::B<int>::b(int)",
            "participant_id": "2002310682025149090"
          },
          "name": "a(int)",
          "return_type": "void",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20009/t20009.cc",
            "line": 11
          },
          "to": {
            "activity_id": "2030629454810805092",
            "activity_name": "clanguml::t20009::A<int>::a(int)",
            "participant_id": "1228498754558363121"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "791066686606379857",
            "activity_name": "clanguml::t20009::tmain()",
            "participant_id": "791066686606379857",
            "participant_name": "clanguml::t20009::tmain()"
          },
          "name": "b(float)",
          "return_type": "void",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20009/t20009.cc",
            "line": 26
          },
          "to": {
            "activity_id": "367805163135583282",
            "activity_name": "clanguml::t20009::B<float>::b(float)",
            "participant_id": "1461902328659683203"
          },
          "type": "message"
        },
        {
          "from": {
            "activity_id": "367805163135583282",
            "activity_name": "clanguml::t20009::B<float>::b(float)",
            "participant_id": "1461902328659683203"
          },
          "name": "a(float)",
          "return_type": "void",
          "scope": "normal",
          "source_location": {
            "file": "../../tests/t20009/t20009.cc",
            "line": 11
          },
          "to": {
            "activity_id": "1643733911490581293",
            "activity_name": "clanguml::t20009::A<float>::a(float)",
            "participant_id": "1243520246309441967"
          },
          "type": "message"
        }
      ],
      "start_from": {
        "id": 791066686606379857,
        "location": "clanguml::t20009::tmain()"
      }
    }
  ],
  "using_namespace": "clanguml::t20009"
}