# t20029 - Combined feature sequence diagram test case ## Config ```yaml compilation_database_dir: .. output_directory: puml diagrams: t20029_sequence: type: sequence glob: - ../../tests/t20029/t20029.cc include: namespaces: - clanguml::t20029 exclude: access: - private using_namespace: - clanguml::t20029 start_from: - function: clanguml::t20029::tmain() participants_order: - clanguml::t20029::tmain() - clanguml::t20029::Encoder> - clanguml::t20029::Retrier - clanguml::t20029::ConnectionPool - clanguml::t20029::encode_b64(std::string &&) ``` ## Source code File t20029.cc ```cpp #include #include #include #include #include namespace clanguml { namespace t20029 { std::string encode_b64(std::string &&content) { return std::move(content); } template class Encoder : public T { public: bool send(std::string &&msg) { return T::send(std::move(encode(std::move(msg)))); } protected: std::string encode(std::string &&msg) { return encode_b64(std::move(msg)); } }; template class Retrier : public T { public: bool send(std::string &&msg) { std::string buffer{std::move(msg)}; int retryCount = 5; while (retryCount--) { if (T::send(buffer)) return true; } return false; } }; class ConnectionPool { public: void connect() { if (!is_connected_.load()) connect_impl(); } bool send(const std::string &msg) { return true; } private: void connect_impl() { is_connected_ = true; } std::atomic is_connected_; }; int tmain() { auto pool = std::make_shared>>(); pool->connect(); for (std::string line; std::getline(std::cin, line);) { if (!pool->send(std::move(line))) break; } return 0; } } } ``` ## Generated UML diagrams ![t20029_sequence](./t20029_sequence.svg "Combined feature sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { "clang_uml_version": "0.3.4-21-g665c784", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, "name": "t20029_sequence", "participants": [ { "id": "2091374738808319642", "name": "clanguml::t20029::tmain()", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 55 }, "type": "function" }, { "id": "1673261195873192383", "name": "clanguml::t20029::Encoder>", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 11 }, "type": "class" }, { "id": "658058855590948094", "name": "clanguml::t20029::Retrier", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 22 }, "type": "class" }, { "id": "1896406205097618937", "name": "clanguml::t20029::ConnectionPool", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 39 }, "type": "class" }, { "id": "1362646431260879440", "name": "clanguml::t20029::encode_b64(std::string &&)", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 9 }, "type": "function" } ], "sequences": [ { "messages": [ { "from": { "activity_id": "2091374738808319642", "activity_name": "clanguml::t20029::tmain()", "participant_id": "2091374738808319642", "participant_name": "clanguml::t20029::tmain()" }, "name": "connect()", "return_type": "void", "scope": "normal", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 59 }, "to": { "activity_id": "940428568182104530", "activity_name": "clanguml::t20029::ConnectionPool::connect()", "participant_id": "1896406205097618937" }, "type": "message" }, { "activity_id": "2091374738808319642", "messages": [ { "activity_id": "2091374738808319642", "branches": [ { "messages": [ { "from": { "activity_id": "2091374738808319642", "activity_name": "clanguml::t20029::tmain()", "participant_id": "2091374738808319642", "participant_name": "clanguml::t20029::tmain()" }, "name": "send(std::string &&)", "return_type": "_Bool", "scope": "condition", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 62 }, "to": { "activity_id": "2026763864005979273", "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", "participant_id": "1673261195873192383" }, "type": "message" }, { "from": { "activity_id": "2026763864005979273", "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", "participant_id": "1673261195873192383" }, "name": "encode(std::string &&)", "return_type": "std::string", "scope": "normal", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 15 }, "to": { "activity_id": "1468258269466480773", "activity_name": "clanguml::t20029::Encoder>::encode(std::string &&)", "participant_id": "1673261195873192383" }, "type": "message" }, { "from": { "activity_id": "1468258269466480773", "activity_name": "clanguml::t20029::Encoder>::encode(std::string &&)", "participant_id": "1673261195873192383" }, "name": "", "return_type": "", "scope": "normal", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 19 }, "to": { "activity_id": "1362646431260879440", "activity_name": "clanguml::t20029::encode_b64(std::string &&)", "participant_id": "1362646431260879440" }, "type": "message" }, { "from": { "activity_id": "2026763864005979273", "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", "participant_id": "1673261195873192383" }, "name": "send(std::string &&)", "return_type": "_Bool", "scope": "normal", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 15 }, "to": { "activity_id": "30515971485361302", "activity_name": "clanguml::t20029::Retrier::send(std::string &&)", "participant_id": "658058855590948094" }, "type": "message" }, { "activity_id": "30515971485361302", "messages": [ { "activity_id": "30515971485361302", "branches": [ { "messages": [ { "from": { "activity_id": "30515971485361302", "activity_name": "clanguml::t20029::Retrier::send(std::string &&)", "participant_id": "658058855590948094" }, "name": "send(const std::string &)", "return_type": "_Bool", "scope": "condition", "source_location": { "file": "../../tests/t20029/t20029.cc", "line": 31 }, "to": { "activity_id": "972625940114169157", "activity_name": "clanguml::t20029::ConnectionPool::send(const std::string &)", "participant_id": "1896406205097618937" }, "type": "message" } ], "type": "consequent" } ], "name": "if", "type": "alt" } ], "name": "while", "type": "loop" } ], "type": "consequent" } ], "name": "if", "type": "alt" } ], "name": "for", "type": "loop" } ], "start_from": { "id": 2091374738808319642, "location": "clanguml::t20029::tmain()" } } ], "using_namespace": "clanguml::t20029" } ```