Model of a sequence diagram. More...
#include <diagram.h>
Public Member Functions | |
diagram ()=default | |
diagram (const diagram &)=delete | |
diagram (diagram &&)=default | |
diagram & | operator= (const diagram &)=delete |
diagram & | operator= (diagram &&)=default |
common::model::diagram_t | type () const override |
Get the diagram model type - in this case sequence. | |
common::optional_ref< common::model::diagram_element > | get (const std::string &full_name) const override |
Search for element in the diagram by fully qualified name. | |
common::optional_ref< common::model::diagram_element > | get (eid_t id) const override |
Search for element in the diagram by id. | |
template<typename T > | |
common::optional_ref< T > | get_participant (eid_t id) const |
Get participant by id. | |
void | add_participant (std::unique_ptr< participant > p) |
Add sequence diagram participant. | |
void | add_active_participant (eid_t id) |
Set participant with id as active. | |
bool | has_activity (eid_t id) const |
Check if diagram has activity identified by caller id. | |
const activity & | get_activity (eid_t id) const |
Get reference to current activity of a participant. | |
activity & | get_activity (eid_t id) |
Get reference to current activity of a participant. | |
void | add_message (model::message &&message) |
Add message to current activity. | |
void | add_block_message (model::message &&message) |
Add block message to the current activity. | |
void | end_block_message (model::message &&message, common::model::message_t start_type) |
End current block message. | |
void | add_case_stmt_message (model::message &&m) |
Add switch block case statement. | |
std::map< eid_t, activity > & | sequences () |
Get all sequences in the diagram. | |
const std::map< eid_t, activity > & | sequences () const |
Get all sequences in the diagram. | |
std::map< eid_t, std::unique_ptr< participant > > & | participants () |
Get map of all participants in the diagram. | |
const std::map< eid_t, std::unique_ptr< participant > > & | participants () const |
Get map of all participants in the diagram. | |
std::set< eid_t > & | active_participants () |
Get all active participants in the diagram. | |
const std::set< eid_t > & | active_participants () const |
Get all active participants in the diagram. | |
std::string | to_alias (const std::string &full_name) const |
Convert element full name to PlantUML alias. | |
void | print () const |
Debug method for printing entire diagram to console. | |
bool | should_include (const sequence_diagram::model::participant &p) const |
Convenience should_include overload for participant. | |
std::vector< std::string > | list_from_values () const |
Get list of all possible 'from' values in the model. | |
std::vector< std::string > | list_to_values () const |
Get list of all possible 'to' values in the model. | |
std::vector< message_chain_t > | get_all_from_to_message_chains (eid_t from_activity, eid_t to_activity) const |
Generate a list of message chains matching a from_to constraint. | |
void | build_reverse_call_graph (reverse_call_graph_activity_node &node, std::set< eid_t > visited_callers={}) const |
Build reverse call graph. | |
std::vector< eid_t > | get_to_activity_ids (const config::source_location &to_location) const |
Get ids of activities matching 'to'. | |
std::vector< eid_t > | get_from_activity_ids (const config::source_location &from_location) const |
Get ids of activities matching 'from'. | |
void | finalize () override |
Once the diagram is complete, run any final processing. | |
bool | is_empty () const override |
Check whether the diagram is empty. | |
void | inline_lambda_operator_calls () |
Public Member Functions inherited from clanguml::common::model::diagram | |
diagram () | |
diagram (const diagram &)=delete | |
diagram (diagram &&) noexcept | |
diagram & | operator= (const diagram &)=delete |
diagram & | operator= (diagram &&) noexcept |
virtual | ~diagram () |
virtual diagram_t | type () const =0 |
Return type of the diagram. | |
virtual opt_ref< clanguml::common::model::diagram_element > | get (const std::string &full_name) const =0 |
virtual common::optional_ref< clanguml::common::model::diagram_element > | get (eid_t id) const =0 |
virtual common::optional_ref< clanguml::common::model::diagram_element > | get_with_namespace (const std::string &name, const namespace_ &ns) const |
void | set_name (const std::string &name) |
std::string | name () const |
void | set_filter (std::unique_ptr< diagram_filter > filter) |
const diagram_filter & | filter () const |
void | set_complete (bool complete) |
Set diagram in a complete state. | |
bool | complete () const |
Whether the diagram is complete. | |
virtual void | finalize () |
Once the diagram is complete, run any final processing. | |
bool | should_include (const element &e) const |
bool | should_include (const namespace_ &ns) const |
bool | should_include (const source_file &path) const |
bool | should_include (relationship r) const |
bool | should_include (relationship_t r) const |
bool | should_include (access_t s) const |
bool | should_include (const std::string &s) const =delete |
virtual bool | has_element (const eid_t) const |
virtual bool | should_include (const namespace_ &ns, const std::string &name) const |
virtual bool | is_empty () const =0 |
Check whether the diagram is empty. | |
virtual void | apply_filter () |
Private Member Functions | |
void | fold_or_end_block_statement (message &&m, common::model::message_t statement_begin, std::vector< message > ¤t_messages) const |
bool | is_begin_block_message (common::model::message_t mt) |
bool | is_end_block_message (common::model::message_t mt) |
bool | inline_lambda_operator_call (eid_t id, model::activity &new_activity, const model::message &m) |
Private Attributes | |
std::map< eid_t, activity > | activities_ |
std::map< eid_t, std::unique_ptr< participant > > | participants_ |
std::set< eid_t > | active_participants_ |
|
default |
|
delete |
|
default |
std::set< eid_t > & clanguml::sequence_diagram::model::diagram::active_participants | ( | ) |
Get all active participants in the diagram.
Definition at line 196 of file diagram.cc.
const std::set< eid_t > & clanguml::sequence_diagram::model::diagram::active_participants | ( | ) | const |
Get all active participants in the diagram.
Definition at line 198 of file diagram.cc.
void clanguml::sequence_diagram::model::diagram::add_active_participant | ( | eid_t | id | ) |
Set participant with id
as active.
id | Id of participant to activate |
Definition at line 110 of file diagram.cc.
void clanguml::sequence_diagram::model::diagram::add_block_message | ( | model::message && | message | ) |
Add block message to the current activity.
Block messages represent sequence diagram blocks such as alt
or loop
.
The block messages can be stacked.
message | Message model |
Definition at line 143 of file diagram.cc.
void clanguml::sequence_diagram::model::diagram::add_case_stmt_message | ( | model::message && | m | ) |
Add switch
block case
statement.
m | Message model |
Definition at line 161 of file diagram.cc.
void clanguml::sequence_diagram::model::diagram::add_message | ( | model::message && | message | ) |
Add message to current activity.
message | Message model |
Definition at line 124 of file diagram.cc.
void clanguml::sequence_diagram::model::diagram::add_participant | ( | std::unique_ptr< participant > | p | ) |
Add sequence diagram participant.
p | Sequence diagram participant model |
Definition at line 91 of file diagram.cc.
void clanguml::sequence_diagram::model::diagram::build_reverse_call_graph | ( | reverse_call_graph_activity_node & | node, |
std::set< eid_t > | visited_callers = {} |
||
) | const |
Build reverse call graph.
This method builds a reverse call graph tree based on callers()
list stored in each activity.
node | The current reverse call graph node |
visited_callers | This is necessary for breaking recursive calls |
Definition at line 309 of file diagram.cc.
void clanguml::sequence_diagram::model::diagram::end_block_message | ( | model::message && | message, |
common::model::message_t | start_type | ||
) |
End current block message.
message | Message model |
start_type | Type of block statement. |
Definition at line 148 of file diagram.cc.
|
overridevirtual |
Once the diagram is complete, run any final processing.
This method should be overriden by specific diagram models to do some final tasks like cleaning up the model (e.g. some filters only work on completed diagrams).
Reimplemented from clanguml::common::model::diagram.
Definition at line 620 of file diagram.cc.
|
private |
This method checks the last messages in sequence (current_messages), if they represent a block sequence identified by statement_begin (e.g. if/else) and there are no actual call expressions within this block statement the entire block statement is removed from the end of the sequence.
Otherwise the block statement is ended with a proper statement (e.g. endif)
m | Message to add to the sequence |
statement_begin | Type of message which begins this type of block statement (e.g. message_t::kIf) |
current_messages | Reference to the sequence messages which should be amended |
Definition at line 595 of file diagram.cc.
|
overridevirtual |
Search for element in the diagram by fully qualified name.
full_name | Fully qualified element name. |
Implements clanguml::common::model::diagram.
Definition at line 66 of file diagram.cc.
|
overridevirtual |
Search for element in the diagram by id.
id | Element id. |
Implements clanguml::common::model::diagram.
Definition at line 77 of file diagram.cc.
Get reference to current activity of a participant.
id | Participant id |
Definition at line 122 of file diagram.cc.
Get reference to current activity of a participant.
id | Participant id |
Definition at line 115 of file diagram.cc.
std::vector< message_chain_t > clanguml::sequence_diagram::model::diagram::get_all_from_to_message_chains | ( | eid_t | from_activity, |
eid_t | to_activity | ||
) | const |
Generate a list of message chains matching a from_to constraint.
If 'from_activity' is 0, this method will return all message chains ending in 'to_activity'.
from_activity | Source activity for from_to message chain |
to_activity | Target activity for from_to message chain |
Definition at line 336 of file diagram.cc.
std::vector< eid_t > clanguml::sequence_diagram::model::diagram::get_from_activity_ids | ( | const config::source_location & | from_location | ) | const |
Get ids of activities matching 'from'.
from_location | Source activity |
Definition at line 281 of file diagram.cc.
|
inline |
std::vector< eid_t > clanguml::sequence_diagram::model::diagram::get_to_activity_ids | ( | const config::source_location & | to_location | ) | const |
Get ids of activities matching 'to'.
to_location | Target activity |
Definition at line 250 of file diagram.cc.
bool clanguml::sequence_diagram::model::diagram::has_activity | ( | eid_t | id | ) | const |
Check if diagram has activity identified by caller id.
id | Caller id representing the activity |
Definition at line 120 of file diagram.cc.
|
private |
Definition at line 510 of file diagram.cc.
void clanguml::sequence_diagram::model::diagram::inline_lambda_operator_calls | ( | ) |
If option to inline lambda calls is enabled, we need to modify the sequences to skip the lambda calls. In case lambda call does not lead to a non-lambda call, omit it entirely
Definition at line 434 of file diagram.cc.
|
inlineprivate |
|
overridevirtual |
Check whether the diagram is empty.
Implements clanguml::common::model::diagram.
Definition at line 429 of file diagram.cc.
|
inlineprivate |
Definition at line 359 of file diagram.h.
std::vector< std::string > clanguml::sequence_diagram::model::diagram::list_from_values | ( | ) | const |
Get list of all possible 'from' values in the model.
Definition at line 211 of file diagram.cc.
std::vector< std::string > clanguml::sequence_diagram::model::diagram::list_to_values | ( | ) | const |
Get list of all possible 'to' values in the model.
Definition at line 229 of file diagram.cc.
std::map< eid_t, std::unique_ptr< participant > > & clanguml::sequence_diagram::model::diagram::participants | ( | ) |
Get map of all participants in the diagram.
Definition at line 185 of file diagram.cc.
const std::map< eid_t, std::unique_ptr< participant > > & clanguml::sequence_diagram::model::diagram::participants | ( | ) | const |
Get map of all participants in the diagram.
Definition at line 191 of file diagram.cc.
void clanguml::sequence_diagram::model::diagram::print | ( | ) | const |
Debug method for printing entire diagram to console.
Definition at line 544 of file diagram.cc.
Get all sequences in the diagram.
Definition at line 178 of file diagram.cc.
Get all sequences in the diagram.
Definition at line 180 of file diagram.cc.
bool clanguml::sequence_diagram::model::diagram::should_include | ( | const sequence_diagram::model::participant & | p | ) | const |
Convenience should_include
overload for participant.
p | Participant model |
Definition at line 203 of file diagram.cc.
std::string clanguml::sequence_diagram::model::diagram::to_alias | ( | const std::string & | full_name | ) | const |
Convert element full name to PlantUML alias.
full_name | Full name of the diagram element. |
Definition at line 86 of file diagram.cc.
|
overridevirtual |
Get the diagram model type - in this case sequence.
Implements clanguml::common::model::diagram.
Definition at line 61 of file diagram.cc.
|
private |
|
private |