X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.fmil%2Fsrc%2Forg%2Fsimantics%2Ffmil%2FFMIL.java;h=39b90b1d0e0b474d1a57b0729deda3cf5341b529;hb=2f1722c73a054adc1df1fcd07a61c82ad96b2063;hp=1302634970eee16fb7e18ee55a48a7b83c509e3a;hpb=dd1ca5e5d7fae427cae08e16c14e519df4727500;p=simantics%2Ffmil.git diff --git a/org.simantics.fmil/src/org/simantics/fmil/FMIL.java b/org.simantics.fmil/src/org/simantics/fmil/FMIL.java index 1302634..39b90b1 100644 --- a/org.simantics.fmil/src/org/simantics/fmil/FMIL.java +++ b/org.simantics.fmil/src/org/simantics/fmil/FMIL.java @@ -107,10 +107,17 @@ public class FMIL { private String[] variableNames; private String[] variableDescriptions; + private String[] variableDeclaredTypes; private int[] variableReferences; private int[] variableTypes; private int[] variableCausalities; private int[] variableVariabilities; + + private String[] declaredTypes; + private String[] declaredTypeDescriptions; + private String[] declaredTypeQuantities; + private String[] declaredTypeUnits; + private TObjectIntHashMap variableMap = new TObjectIntHashMap(); private Set subscriptionSet = new HashSet(); @@ -212,7 +219,7 @@ public class FMIL { fmuLoaded = true; } catch (UnsatisfiedLinkError err) { - throw new FMILException(UNSATISFIED_LINK); + throw new FMILException(UNSATISFIED_LINK, err); } catch (Exception e) { throw new FMILException(e.getMessage()); } @@ -607,6 +614,26 @@ public class FMIL { private native String[] getAllVariableDescriptions_(int id); + public String[] getAllVariableDeclaredTypes() throws FMILException { + synchronized(syncObject) { + + try { + + if(variableDeclaredTypes == null) { + variableDeclaredTypes = getAllVariableDeclaredTypes_(getModelIDNew()); + } + return variableDeclaredTypes; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllVariableDeclaredTypes_(int id); + public int[] getAllVariableReferences() throws FMILException { synchronized(syncObject) { @@ -686,6 +713,91 @@ public class FMIL { } private native int[] getAllVariableVariabilities_(int id, int[] array); + + /** + * Get all variables in a loaded model + * @return all variables in a loaded model + */ + public String[] getAllDeclaredTypes() throws FMILException { + synchronized(syncObject) { + + try { + + if(declaredTypes == null) { + declaredTypes = getAllDeclaredTypes_(getModelIDNew()); + } + return declaredTypes; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllDeclaredTypes_(int id); + + public String[] getAllDeclaredTypeDescriptions() throws FMILException { + synchronized(syncObject) { + + try { + + if(declaredTypeDescriptions == null) { + declaredTypeDescriptions = getAllDeclaredTypeDescriptions_(getModelIDNew()); + } + return declaredTypeDescriptions; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllDeclaredTypeDescriptions_(int id); + + public String[] getAllDeclaredTypeQuantities() throws FMILException { + synchronized(syncObject) { + + try { + + if(declaredTypeQuantities == null) { + declaredTypeQuantities = getAllDeclaredTypeQuantities_(getModelIDNew()); + } + return declaredTypeQuantities; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllDeclaredTypeQuantities_(int id); + + public String[] getAllDeclaredTypeUnits() throws FMILException { + synchronized(syncObject) { + + try { + + if(declaredTypeUnits == null) { + declaredTypeUnits = getAllDeclaredTypeUnits_(getModelIDNew()); + } + return declaredTypeUnits; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllDeclaredTypeUnits_(int id); + // // /**