public static class FMICallbackFunctions.ByValue extends FMICallbackFunctions implements com.sun.jna.Structure.ByValue
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.
FMICallbackFunctions.ByValue
allocateMemory, freeMemory, logger, stepFinished
Constructor and Description |
---|
ByValue(FMILibrary.FMICallbackLogger logger,
FMILibrary.FMICallbackAllocateMemory allocateMemory,
FMILibrary.FMICallbackFreeMemory freeMemory,
FMILibrary.FMIStepFinished stepFinished)
Access the structure by reference.
|
getFieldOrder, initFieldOrder
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
public ByValue(FMILibrary.FMICallbackLogger logger, FMILibrary.FMICallbackAllocateMemory allocateMemory, FMILibrary.FMICallbackFreeMemory freeMemory, FMILibrary.FMIStepFinished stepFinished)
See http://twall.github.com/jna/3.4.0/javadoc/overview-summary.html#structures: "To pass a structure by value, first define the structure, then define an empty class from that which implements Structure.ByValue. Use the ByValue class as the argument or return type."
logger
- The method called to log a status message
(C type: fmiCallbackLogger).allocateMemory
- The method called to allocate cleared memory
(C type: fmiCallbackAllocateMemoryfreeMemory
- The method called to free allocated memory
(C type: fmiCallbackFreeMemory)stepFinished
- The method called when the step is finished.
(C type: FmiStepFinished)