Class FMICallbackFunctions.ByValue

  • All Implemented Interfaces:
    com.sun.jna.Structure.ByValue
    Enclosing class:
    FMICallbackFunctions

    public static class FMICallbackFunctions.ByValue
    extends FMICallbackFunctions
    implements com.sun.jna.Structure.ByValue
    A class that contains references to the callback functions.

    This class is used to register callbacks and pass the callbacks to the fmiInstantiateSlave() or fmiInstantiateModel() method. For example FMUCoSimulation.java contains the following code:

       FMICallbackFunctions.ByValue callbacks = new FMICallbackFunctions.ByValue(
               new FMULibrary.FMULogger(), new FMULibrary.FMUAllocateMemory(),
               new FMULibrary.FMUFreeMemory(),
               new FMULibrary.FMUStepFinished());
    
       Function instantiateSlave = fmiModelDescription.getFmiFunction("fmiInstantiateSlave");
    
       Pointer fmiComponent = (Pointer) instantiateSlave.invoke(Pointer.class,
                new Object[] { _modelIdentifier, fmiModelDescription.guid,
                        fmuLocation, mimeType, timeout, visible, interactive,
                       callbacks, loggingOn });
      

    The Structure.ByValue interface is a marker interface that indicates that the value value of a Structure is to be used by function invocations instead of the address of the Structure. This is necessary because the default is that Structure arguments and return values are usually accessed by reference. For details, see http://twall.github.com/jna/3.4.0/javadoc/com/sun/jna/Structure.ByValue.html.

    For details about how Callbacks work in JNA, see http://twall.github.com/jna/3.4.0/javadoc/overview-summary.html#callbacks.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.sun.jna.Structure

        com.sun.jna.Structure.ByReference, com.sun.jna.Structure.StructField
    • Method Summary

      • Methods inherited from class com.sun.jna.Structure

        allocateMemory, allocateMemory, autoAllocate, autoRead, autoRead, autoWrite, autoWrite, cacheTypeInfo, clear, ensureAllocated, equals, fieldOffset, getAutoRead, getAutoWrite, getFieldList, getFields, getNativeAlignment, getNativeSize, getNativeSize, getPointer, getStringEncoding, getStructAlignment, hashCode, newInstance, newInstance, read, readField, readField, setAlignType, setAutoRead, setAutoSynch, setAutoWrite, setFieldOrder, setStringEncoding, size, sortFields, toArray, toArray, toString, toString, useMemory, useMemory, write, writeField, writeField, writeField
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait