Main Content

getDefaultElementStereotype

Get default stereotype for elements

Since R2021b

Description

stereotype = getDefaultElementStereotype(stereotype,elementType) gets the default stereotype stereotype of the child elements whose parent element of type elementType has the stereotype stereotype applied.

example

Examples

collapse all

Create a profile for latency characteristics and save it.

profile = systemcomposer.profile.Profile.createProfile("LatencyProfile");

latencybase = profile.addStereotype("LatencyBase");
latencybase.addProperty("latency",Type="double");
latencybase.addProperty("dataRate",Type="double",DefaultValue="10");

connLatency = profile.addStereotype("ConnectorLatency",...
Parent="LatencyProfile.LatencyBase");
connLatency.addProperty("secure",Type="boolean");
connLatency.addProperty("linkDistance",Type="double");

nodeLatency = profile.addStereotype("NodeLatency",...
Parent="LatencyProfile.LatencyBase");
nodeLatency.addProperty("resources",Type="double",DefaultValue="1");

portLatency = profile.addStereotype("PortLatency",...
Parent="LatencyProfile.LatencyBase");
portLatency.addProperty("queueDepth",Type="double");
portLatency.addProperty("dummy",Type="int32");

profile.save

Specify the LatencyProfile.NodeLatency stereotype as a component stereotype. Set the default component stereotype.

nodeLatency.AppliesTo = "Component";
nodeLatency.setDefaultElementStereotype("Component","LatencyProfile.NodeLatency")

Get the default component stereotype on nodeLatency.

stereotype = getDefaultElementStereotype(nodeLatency,"Component")
stereotype = 

  Stereotype with properties:

                    Name: 'NodeLatency'
             Description: ''
                  Parent: [1×1 systemcomposer.profile.Stereotype]
               AppliesTo: 'Component'
                Abstract: 0
                    Icon: 'default'
    ComponentHeaderColor: [210 210 210]
      ConnectorLineColor: [168 168 168]
      ConnectorLineStyle: 'Default'
      FullyQualifiedName: 'LatencyProfile.NodeLatency'
                 Profile: [1×1 systemcomposer.profile.Profile]
         OwnedProperties: [1×1 systemcomposer.profile.Property]
              Properties: [1×3 systemcomposer.profile.Property]

Input Arguments

collapse all

Element type, specified as:

Data Types: char | string

Stereotype, specified as a systemcomposer.profile.Stereotype object.

Output Arguments

collapse all

Default stereotype, returned as a systemcomposer.profile.Stereotype object.

More About

collapse all

Version History

Introduced in R2021b