MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - check which port not connected
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

check which port not connected

 Post Reply Post Reply
edward22243 View Drop Down
Major Contributor
Major Contributor

Joined: 19.Apr.2019
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote edward22243 Quote  Post ReplyReply Direct Link To This Post Topic: check which port not connected
    Posted: 21.Oct.2021 at 08:38
I have an object with ports and I want to check if they are all connected.
But when I do something like this:

@cnt = '0'
foreach .TopicPublisher {
do #PubSubConnector {
 @connected = 'F'
 do ~ToTopic~From.() {
@connected = 'T'
 if @connected = 'F' then
@error = 'T'
' not connected' newline

than the counter is stuck at 2 , this  means only do #PubSubConnector is 'entered' when it is already connected. It seems the connector does not exist if nothing is connected to it. 
So how can I check if every connector (all 4 in the picture below) is connected to something?

Back to Top
jpt View Drop Down

Joined: 25.Mar.2008
Points: 222
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpt Quote  Post ReplyReply Direct Link To This Post Posted: 21.Oct.2021 at 10:28
Yes, do #() shows all connected ports. To make comparison the generator must compare connections via ports with the all possible ports available. Depending on the metamodel, all possible ports are  defined in a subgraph, as properties of the object (‘TopicPublisher’), or somewhere else.

Demo repository includes a project ‘EAST-ADL’ in which graph type ‘HardwareComponentType’ has quite similar functionality discussed here. Please check generator named ‘Unconnected pins’. It is run as a part of LiveCheck generator showing at modeling time the status of unconnected pins. In this example the pins (ports) are defined in the subgraph, so the generator seeks all available ports from there. If your metamodel defined ports similarly in a subgraph the right would be something like:

subreport '_translators' run
/* Reports the unconnected ports */
foreach .TopicPublisher {
@ports = ' '
@unused_ports = ''
/* Set the ports variable to include all the connected ports */
do #() { local 'ports' append oid ' ' close }
/* Compares all the ports with the connected ports */
do decompositions
{ foreach .(*Port*) { /* take only elements named as *Port* */
if not @ports =~ oid%wildsp then
local 'unused_ports' append id newline close
/* Report all the unconnected pins */
do @unused_ports where id
{ id ' not connected' newline

If ports are defined as properties of TopicPublisher the ports must be stored differently etc.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 10.16
Copyright ©2001-2013 Web Wiz Ltd.

This page was generated in 0.063 seconds.