Looking for the subprograms in an instanciation of an AADL model

13 views
Skip to first unread message

Eric Lubat

unread,
Oct 19, 2023, 7:10:22 AM10/19/23
to OSATE

Hi!


I'd like to use an instanciated model of an AADL system (as an input) and I need to get the subprograms.

Are the subprograms instanciated? Or do I need to use another trick?


Best Regards,


Eric LUBAT

Brian Larson

unread,
Oct 20, 2023, 4:46:03 AM10/20/23
to OSATE
Eric,
Look for useful utilities and classes for instance models in package org.osate.aadl2.instance.util;

You will want to sub-class InstanceSwitch<T> found in InstanceSwitch.java
Override caseInstanceObject to add each InstanceObject to a vector if it is a subprogram.
You may need to override some of the other methods, too, so doSwitch walks the instance model tree to caseInstanceObject without stopping early.

Switches are tricky to use, but they are auto-generated to match the EMF metamodel, so can be slick when processing EMF models like the instance model.
Once you get the hang of switches you will be able to easily extract what you need from an instance model.

--Brian
Reply all
Reply to author
Forward
0 new messages