-
Notifications
You must be signed in to change notification settings - Fork 24
fix: improvement add interfaces in comp drawing #468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7c21e6f
f706a59
2b45d5c
04508d8
ba84aed
bae012b
4e91ec1
e47945a
3c67e00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -392,6 +392,40 @@ def draw_module( | |
| return structure_text, linkage_text, proc_impl_interfaces, proc_used_interfaces | ||
|
|
||
|
|
||
| def _resolve_component_for_view( | ||
| need: dict[str, str], all_needs: dict[str, dict[str, str]] | ||
| ) -> dict[str, str]: | ||
| """Resolve component architecture views to their owning component.""" | ||
| if need.get("type") != "comp_arc_sta": | ||
| return need | ||
|
|
||
|
Comment on lines
+395
to
+401
|
||
| component_ref = need.get("belongs_to") | ||
| if isinstance(component_ref, list) and component_ref: | ||
| component_id = component_ref[0] | ||
| if len(component_ref) > 1: | ||
| logger.info( | ||
| f"{need}: component static view has multiple belongs_to targets, " | ||
| f"using only first component: {component_id}" | ||
| ) | ||
|
|
||
| else: | ||
| component_id = component_ref | ||
| if not component_id: | ||
| logger.info(f"{need}: missing belongs_to for component static view") | ||
| return need | ||
|
|
||
| component_need = all_needs.get(component_id, {}) | ||
| if not component_need: | ||
| logger.info(f"{need}: belongs_to component {component_id} could not be found") | ||
| return need | ||
|
|
||
| if component_need.get("type") != "comp": | ||
| logger.info(f"{need}: belongs_to {component_id} is not a component") | ||
| return need | ||
|
|
||
| return component_need | ||
RolandJentschETAS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| # ╭──────────────────────────────────────────────────────────────────────────────╮ | ||
| # │ Classes with hashing to enable caching │ | ||
| # ╰──────────────────────────────────────────────────────────────────────────────╯ | ||
|
|
@@ -575,16 +609,16 @@ def __repr__(self): | |
| def __call__( | ||
| self, need: dict[str, str], all_needs: dict[str, dict[str, str]] | ||
| ) -> str: | ||
| structure_text, linkage_text, _, _ = draw_comp_incl_impl_int( | ||
| need, all_needs, dict(), dict(), True | ||
| component_need = _resolve_component_for_view(need, all_needs) | ||
| structure_text, linkage_text, proc_impl_interfaces, _ = draw_comp_incl_impl_int( | ||
| component_need, all_needs, dict(), dict(), True | ||
| ) | ||
|
Comment on lines
+612
to
615
|
||
|
|
||
| # Draw all implemented interfaces outside the boxes | ||
| local_impl_interfaces = draw_impl_interface(need, all_needs, set()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now completely missing. Is that on purpose?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Before only local interface are drawn. Now this is extended to any interface. Not sure, why this difference was made in the past, but lead to missing interfaces. Now any impl interface is drawn. See the next line. The loop goes over any implementation interfaces and not only the local ones. |
||
|
|
||
| # Add all interfaces which are implemented by component to global list | ||
| # and provide implementation | ||
| for iface in local_impl_interfaces: | ||
| # and provide implementation. Use the interfaces collected during the | ||
| # recursive consists_of walk so component drawings also include | ||
| # interfaces implemented by nested subcomponents. | ||
| for iface in proc_impl_interfaces: | ||
|
Comment on lines
617
to
+621
|
||
| # check for misspelled implements | ||
| if not all_needs.get(iface, []): | ||
| logger.info(f"{need}: implements {iface} could not be found") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this compare against "comp"?