# t20004 - Function template instantiation sequence diagram test case ## Config ```yaml diagrams: t20004_sequence: type: sequence glob: - t20004.cc include: namespaces: - clanguml::t20004 using_namespace: clanguml::t20004 from: - function: "clanguml::t20004::main()" ``` ## Source code File `tests/t20004/t20004.cc` ```cpp #include namespace clanguml { namespace t20004 { template T m4(T p); template <> [[maybe_unused]] int m4(int p) { return p + 2; } template <> [[maybe_unused]] unsigned long m4(unsigned long p) { return 1000 * p; } template T m3(T p) { return m4(p); } template T m2(T p) { return m3(p); } template <> [[maybe_unused]] std::string m2(std::string p) { return std::string{"m2"} + p; } template T m1(T p) { return m2(p); } template <> [[maybe_unused]] float m1(float p) { return 2 * p; } template <> [[maybe_unused]] unsigned long m1(unsigned long p) { return m4(p); } template <> [[maybe_unused]] std::string m1(std::string p) { return m2(p); } int main() { m1(2.2); m1(100); m1("main"); return m1(0); } } } ``` ## Generated PlantUML diagrams ![t20004_sequence](./t20004_sequence.svg "Function template instantiation sequence diagram test case") ## Generated Mermaid diagrams ![t20004_sequence](./t20004_sequence_mermaid.svg "Function template instantiation sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "name": "t20004_sequence", "participants": [ { "display_name": "main()", "id": "2299662004367884401", "name": "main", "namespace": "clanguml::t20004", "source_location": { "column": 5, "file": "t20004.cc", "line": 38, "translation_unit": "t20004.cc" }, "type": "function" }, { "display_name": "m1(float)", "id": "138925040763435897", "name": "m1", "namespace": "clanguml::t20004", "source_location": { "column": 36, "file": "t20004.cc", "line": 26, "translation_unit": "t20004.cc" }, "type": "function_template" }, { "display_name": "m1(unsigned long)", "id": "1239083518717603720", "name": "m1", "namespace": "clanguml::t20004", "source_location": { "column": 44, "file": "t20004.cc", "line": 28, "translation_unit": "t20004.cc" }, "type": "function_template" }, { "display_name": "m4(unsigned long)", "id": "376599675205498367", "name": "m4", "namespace": "clanguml::t20004", "source_location": { "column": 44, "file": "t20004.cc", "line": 10, "translation_unit": "t20004.cc" }, "type": "function_template" }, { "display_name": "m1(std::string)", "id": "1845817984839618223", "name": "m1", "namespace": "clanguml::t20004", "source_location": { "column": 42, "file": "t20004.cc", "line": 33, "translation_unit": "t20004.cc" }, "type": "function_template" }, { "display_name": "m2(std::string)", "id": "1735054254122948614", "name": "m2", "namespace": "clanguml::t20004", "source_location": { "column": 42, "file": "t20004.cc", "line": 19, "translation_unit": "t20004.cc" }, "type": "function_template" }, { "display_name": "m1(int)", "id": "121663532044911922", "name": "m1", "namespace": "clanguml::t20004", "source_location": { "column": 25, "file": "t20004.cc", "line": 24, "translation_unit": "t20004.cc" }, "type": "function_template" }, { "display_name": "m2(int)", "id": "1475362124497386656", "name": "m2", "namespace": "clanguml::t20004", "source_location": { "column": 25, "file": "t20004.cc", "line": 17, "translation_unit": "t20004.cc" }, "type": "function_template" }, { "display_name": "m3(int)", "id": "734999226157549914", "name": "m3", "namespace": "clanguml::t20004", "source_location": { "column": 25, "file": "t20004.cc", "line": 15, "translation_unit": "t20004.cc" }, "type": "function_template" }, { "display_name": "m4(int)", "id": "1006390865908497562", "name": "m4", "namespace": "clanguml::t20004", "source_location": { "column": 34, "file": "t20004.cc", "line": 8, "translation_unit": "t20004.cc" }, "type": "function_template" } ], "sequences": [ { "messages": [ { "from": { "activity_id": "2299662004367884401", "participant_id": "2299662004367884401" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "column": 5, "file": "t20004.cc", "line": 40, "translation_unit": "t20004.cc" }, "to": { "activity_id": "138925040763435897", "participant_id": "138925040763435897" }, "type": "message" }, { "from": { "activity_id": "2299662004367884401", "participant_id": "2299662004367884401" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "column": 5, "file": "t20004.cc", "line": 42, "translation_unit": "t20004.cc" }, "to": { "activity_id": "1239083518717603720", "participant_id": "1239083518717603720" }, "type": "message" }, { "from": { "activity_id": "1239083518717603720", "participant_id": "1239083518717603720" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "column": 12, "file": "t20004.cc", "line": 30, "translation_unit": "t20004.cc" }, "to": { "activity_id": "376599675205498367", "participant_id": "376599675205498367" }, "type": "message" }, { "from": { "activity_id": "2299662004367884401", "participant_id": "2299662004367884401" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "column": 5, "file": "t20004.cc", "line": 44, "translation_unit": "t20004.cc" }, "to": { "activity_id": "1845817984839618223", "participant_id": "1845817984839618223" }, "type": "message" }, { "from": { "activity_id": "1845817984839618223", "participant_id": "1845817984839618223" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "column": 12, "file": "t20004.cc", "line": 35, "translation_unit": "t20004.cc" }, "to": { "activity_id": "1735054254122948614", "participant_id": "1735054254122948614" }, "type": "message" }, { "from": { "activity_id": "2299662004367884401", "participant_id": "2299662004367884401" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "column": 12, "file": "t20004.cc", "line": 46, "translation_unit": "t20004.cc" }, "to": { "activity_id": "121663532044911922", "participant_id": "121663532044911922" }, "type": "message" }, { "from": { "activity_id": "121663532044911922", "participant_id": "121663532044911922" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "column": 42, "file": "t20004.cc", "line": 24, "translation_unit": "t20004.cc" }, "to": { "activity_id": "1475362124497386656", "participant_id": "1475362124497386656" }, "type": "message" }, { "from": { "activity_id": "1475362124497386656", "participant_id": "1475362124497386656" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "column": 42, "file": "t20004.cc", "line": 17, "translation_unit": "t20004.cc" }, "to": { "activity_id": "734999226157549914", "participant_id": "734999226157549914" }, "type": "message" }, { "from": { "activity_id": "734999226157549914", "participant_id": "734999226157549914" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "column": 42, "file": "t20004.cc", "line": 15, "translation_unit": "t20004.cc" }, "to": { "activity_id": "1006390865908497562", "participant_id": "1006390865908497562" }, "type": "message" } ], "start_from": { "id": 2299662004367884401, "location": "clanguml::t20004::main()" } } ], "using_namespace": "clanguml::t20004" } ```