Java 类com.sun.jna.ptr.FloatByReference 实例源码

项目:hackrf-spectrum-analyzer    文件:HackRFSweepNativeBridge.java   
public static synchronized void start(HackRFSweepDataCallback dataCallback, int freq_min_MHz, int freq_max_MHz, int fft_bin_width, int num_samples,
        int lna_gain, int vga_gain, boolean antennaPowerEnable)
{
    hackrf_sweep_lib_start__fft_power_callback_callback callback = new hackrf_sweep_lib_start__fft_power_callback_callback()
    {
        @Override public void apply(byte sweep_started, int bins, DoubleByReference freqStart, float fftBinWidth, FloatByReference powerdBm)
        {
            double[] freqStartArr = bins == 0 ? null : freqStart.getPointer().getDoubleArray(0, bins);
            float[] powerArr =  bins == 0 ? null : powerdBm.getPointer().getFloatArray(0, bins);
            dataCallback.newSpectrumData(sweep_started==0 ? false : true, freqStartArr, fftBinWidth, powerArr);
        }
    };
    Native.setCallbackThreadInitializer(callback, new CallbackThreadInitializer(true));

    HackrfSweepLibrary.hackrf_sweep_lib_start(callback, freq_min_MHz, freq_max_MHz, fft_bin_width, num_samples, lna_gain, vga_gain, antennaPowerEnable ? 1 : 0);
}
项目:pvwatts-java    文件:IntegrationTestSsc.java   
@Test
public void testModuleLog() {
  Pointer module = ssclib.ssc_module_create("layoutarea");
  boolean result = ssclib.ssc_module_exec(module, data);

  assertThat(result).isFalse();

  int i = 0;
  IntByReference itemType = new IntByReference();
  FloatByReference time = new FloatByReference();
  String logMsg = ssclib.ssc_module_log(module, i, itemType, time);
  do {
    assertThat(logMsg).isNotNull();

    assertThat(itemType.getValue()).isGreaterThan(0);
    assertThat(time.getValue()).isNotWithin(EPSILON).of(0f);

    i++;
    logMsg = ssclib.ssc_module_log(module, i, itemType, time);
  } while (logMsg != null);
}
项目:pvwatts-java    文件:DataContainer.java   
/**
 * Get a numeric input or output number for this module.
 * 
 * @param variableName The name of the variable to retrieve.
 * @return If <tt>variableName</tt> is found, an {@link Optional} containing the value. Otherwise,
 *         an empty {@link Optional}
 * 
 * @throws {@link java.lang.IllegalStateException} if the module has already been {@link #free}ed.
 * @throws {@link java.lang.NullPointerException} if <tt>variableName</tt> is null
 */
public Optional<Float> getNumber(String variableName) {
  checkState();
  checkNotNull(variableName);

  FloatByReference value = new FloatByReference();
  boolean present = api.ssc_data_get_number(data, variableName, value);

  if (present) {
    return Optional.of(value.getValue());
  } else {
    return Optional.empty();
  }
}
项目:pvwatts-java    文件:UnitTestDataContainer.java   
@Test
public void getNonExistentNumber() {
  when(mockApi.ssc_data_get_number(any(Pointer.class), any(String.class),
      any(FloatByReference.class))).thenReturn(false);

  Optional<Float> val = data.getNumber("asdf");
  assertThat(val.isPresent()).isFalse();
}
项目:pvwatts-java    文件:IntegrationTestSsc.java   
@Test
public void setNumber() {
  float targetVal = 0.5f;
  String name = "test";

  ssclib.ssc_data_set_number(data, name, targetVal);
  FloatByReference out = new FloatByReference();
  boolean status = ssclib.ssc_data_get_number(data, name, out);

  assertThat(status).isTrue();
  assertThat(out.getValue()).isWithin(EPSILON).of(targetVal);
}
项目:pvwatts-java    文件:IntegrationTestSsc.java   
/**
 * Private helper to make sure that the data created by the simulation was set as expected.
 * Assumes that we used the "layoutarea" module
 */
private static void checkSimulationData(Ssc ssclib, Pointer data) {
  FloatByReference val = new FloatByReference();
  boolean status = ssclib.ssc_data_get_number(data, "area", val);
  assertThat(status).isTrue();
  assertThat(val.getValue()).isAtLeast(0f);

  IntByReference rows = new IntByReference();
  IntByReference cols = new IntByReference();
  Pointer mtx = ssclib.ssc_data_get_matrix(data, "convex_hull", rows, cols);
  assertThat(mtx).isNotNull();
  assertThat(rows.getValue()).isGreaterThan(0);
  assertThat(cols.getValue()).isGreaterThan(0);
}
项目:jalleg    文件:Game.java   
/**
 * If the mouse addon is installed, return the current mouse position transformed by the given transform.
 */
protected Point getMousePosTransformed(ALLEGRO_TRANSFORM transform) {
    FloatByReference mouseX = new FloatByReference(mouseState.x);
    FloatByReference mouseY = new FloatByReference(mouseState.y);

    al_transform_coordinates(transform, mouseX, mouseY);

    return new Point(mouseX.getValue(), mouseY.getValue());
}
项目:pvwatts-java    文件:Ssc.java   
String ssc_module_log(Pointer module, int index, IntByReference itemType,
FloatByReference time);
项目:lept4j    文件:LeptonicaImpl.java   
@Override
public int boxaCompareRegions(Boxa boxa1, Boxa boxa2, int areathresh, IntByReference pnsame, FloatByReference pdiffarea, FloatByReference pdiffxor, PointerByReference ppixdb) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:lept4j    文件:LeptonicaImpl.java   
@Override
public int pixFindColorRegions(Pix pixs, Pix pixm, int factor, int lightthresh, int darkthresh, int mindiff, int colordiff, float edgefract, FloatByReference pcolorfract, PointerByReference pcolormask1, PointerByReference pcolormask2, Pixa pixadb) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:lept4j    文件:LeptonicaImpl.java   
@Override
public int pixHasHighlightRed(Pix pixs, int factor, float fract, float fthresh, IntByReference phasred, FloatByReference pratio, PointerByReference ppixdb) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:lept4j    文件:LeptonicaImpl.java   
@Override
public int pixCompareBinary(Pix pix1, Pix pix2, int comptype, FloatByReference pfract, PointerByReference ppixdiff) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:lept4j    文件:LeptonicaImpl.java   
@Override
public int pixCompareGrayOrRGB(Pix pix1, Pix pix2, int comptype, int plottype, IntByReference psame, FloatByReference pdiff, FloatByReference prmsdiff, PointerByReference ppixdiff) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:lept4j    文件:LeptonicaImpl.java   
@Override
public int pixCompareGray(Pix pix1, Pix pix2, int comptype, int plottype, IntByReference psame, FloatByReference pdiff, FloatByReference prmsdiff, PointerByReference ppixdiff) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:lept4j    文件:LeptonicaImpl.java   
@Override
public int pixCompareRGB(Pix pix1, Pix pix2, int comptype, int plottype, IntByReference psame, FloatByReference pdiff, FloatByReference prmsdiff, PointerByReference ppixdiff) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:lept4j    文件:LeptonicaImpl.java   
@Override
public int pixGetPerceptualDiff(Pix pixs1, Pix pixs2, int sampling, int dilation, int mindiff, FloatByReference pfract, PointerByReference ppixdiff1, PointerByReference ppixdiff2) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:lept4j    文件:LeptonicaImpl.java   
@Override
public int pixFindStrokeWidth(Pix pixs, float thresh, IntByReference tab8, FloatByReference pwidth, PointerByReference pnahisto) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:JNAerator    文件:GlobalFloat.java   
public GlobalFloat(NativeLibrary library, String... symbols) {
    super(library, FloatByReference.class, symbols);
}
项目:lept4j    文件:Numa.java   
/**
 * @param nalloc size of allocated number array<br>
 * C type : l_int32<br>
 * @param n number of numbers saved<br>
 * C type : l_int32<br>
 * @param refcount reference count (1 if no clones)<br>
 * C type : l_int32<br>
 * @param startx x value assigned to array[0]<br>
 * C type : l_float32<br>
 * @param delx change in x value as i --&gt; i + 1<br>
 * C type : l_float32<br>
 * @param array number array<br>
 * C type : l_float32*
 */
public Numa(int nalloc, int n, int refcount, float startx, float delx, FloatByReference array) {
    super();
    this.nalloc = nalloc;
    this.n = n;
    this.refcount = refcount;
    this.startx = startx;
    this.delx = delx;
    this.array = array;
}
项目:lept4j    文件:FPix.java   
/**
 * @param w width in pixels<br>
 * C type : l_int32<br>
 * @param h height in pixels<br>
 * C type : l_int32<br>
 * @param wpl 32-bit words/line<br>
 * C type : l_int32<br>
 * @param refcount reference count (1 if no clones)<br>
 * C type : l_uint32<br>
 * @param xres image res (ppi) in x direction<br>
 * C type : l_int32<br>
 * @param yres image res (ppi) in y direction<br>
 * C type : l_int32<br>
 * @param data the float image data<br>
 * C type : l_float32*
 */
public FPix(int w, int h, int wpl, int refcount, int xres, int yres, FloatByReference data) {
    super();
    this.w = w;
    this.h = h;
    this.wpl = wpl;
    this.refcount = refcount;
    this.xres = xres;
    this.yres = yres;
    this.data = data;
}
项目:lept4j    文件:Pta.java   
/**
 * @param n actual number of pts<br>
 * C type : l_int32<br>
 * @param nalloc size of allocated arrays<br>
 * C type : l_int32<br>
 * @param refcount reference count (1 if no clones)<br>
 * C type : l_uint32<br>
 * @param x arrays of floats<br>
 * C type : l_float32*<br>
 * @param y arrays of floats<br>
 * C type : l_float32*
 */
public Pta(int n, int nalloc, int refcount, FloatByReference x, FloatByReference y) {
    super();
    this.n = n;
    this.nalloc = nalloc;
    this.refcount = refcount;
    this.x = x;
    this.y = y;
}
项目:DigitalMediaServer    文件:CoreFoundation.java   
/**
 * Creates a new {@link CFNumberRef} instance with the value from
 * {@code value}.
 *
 * @param value the value of the new {@link CFNumberRef} instance.
 * @return The new instance.
 */
public static CFNumberRef toCFNumberRef(float value) {
    return INSTANCE.CFNumberCreate(ALLOCATOR, CFNumberType.kCFNumberFloat32Type, new FloatByReference(value));
}
项目:android-sdk    文件:JNAOpus.java   
/**
 * Opus encode float.
 *
 * @param st             the st
 * @param pcm            the pcm
 * @param frame_size     the frame size
 * @param data           the data
 * @param max_data_bytes the max data bytes
 * @return the int
 */
int opus_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer data, int max_data_bytes);
项目:android-sdk    文件:JNAOpus.java   
/**
 * Opus decode float.
 *
 * @param st         the st
 * @param data       the data
 * @param len        the len
 * @param pcm        the pcm
 * @param frame_size the frame size
 * @param decode_fec the decode fec
 * @return the int
 */
int opus_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size,
                      int decode_fec);
项目:android-sdk    文件:JNAOpus.java   
/**
 * Opus multistream encode float.
 *
 * @param st             the st
 * @param pcm            the pcm
 * @param frame_size     the frame size
 * @param data           the data
 * @param max_data_bytes the max data bytes
 * @return the int
 */
int opus_multistream_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer data,
                                  int max_data_bytes);
项目:android-sdk    文件:JNAOpus.java   
/**
 * Opus multistream decode float.
 *
 * @param st         the st
 * @param data       the data
 * @param len        the len
 * @param pcm        the pcm
 * @param frame_size the frame size
 * @param decode_fec the decode fec
 * @return the int
 */
int opus_multistream_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size,
                                  int decode_fec);
项目:android-sdk    文件:JNAOpus.java   
/**
 * Opus custom encode float.
 *
 * @param st                 the st
 * @param pcm                the pcm
 * @param frame_size         the frame size
 * @param compressed         the compressed
 * @param maxCompressedBytes the max compressed bytes
 * @return the int
 */
int opus_custom_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer compressed,
                             int maxCompressedBytes);
项目:android-sdk    文件:JNAOpus.java   
/**
 * Opus custom decode float.
 *
 * @param st         the st
 * @param data       the data
 * @param len        the len
 * @param pcm        the pcm
 * @param frame_size the frame size
 * @return the int
 */
int opus_custom_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_float32* createMatrix2dTranslate(l_float32, l_float32)</code><br>
 * <i>native declaration : allheaders.h:90</i>
 */
public static native FloatByReference createMatrix2dTranslate(float transx, float transy);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_float32* createMatrix2dScale(l_float32, l_float32)</code><br>
 * <i>native declaration : allheaders.h:92</i>
 */
public static native FloatByReference createMatrix2dScale(float scalex, float scaley);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_float32* createMatrix2dRotate(l_float32, l_float32, l_float32)</code><br>
 * <i>native declaration : allheaders.h:94</i>
 */
public static native FloatByReference createMatrix2dRotate(float xc, float yc, float angle);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_int32 boxaCompareRegions(BOXA*, BOXA*, l_int32, l_int32*, l_float32*, l_float32*, PIX**)</code><br>
 * <i>native declaration : allheaders.h:568</i>
 */
public static native int boxaCompareRegions(Boxa boxa1, Boxa boxa2, int areathresh, IntByReference pnsame, FloatByReference pdiffarea, FloatByReference pdiffxor, PointerByReference ppixdb);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_int32 pixFindColorRegions(PIX*, PIX*, l_int32, l_int32, l_int32, l_int32, l_int32, l_float32, l_float32*, PIX**, PIX**, PIXA*)</code><br>
 * <i>native declaration : allheaders.h:770</i>
 */
public static native int pixFindColorRegions(Pix pixs, Pix pixm, int factor, int lightthresh, int darkthresh, int mindiff, int colordiff, float edgefract, FloatByReference pcolorfract, PointerByReference pcolormask1, PointerByReference pcolormask2, Pixa pixadb);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_int32 pixHasHighlightRed(PIX*, l_int32, l_float32, l_float32, l_int32*, l_float32*, PIX**)</code><br>
 * <i>native declaration : allheaders.h:788</i>
 */
public static native int pixHasHighlightRed(Pix pixs, int factor, float fract, float fthresh, IntByReference phasred, FloatByReference pratio, PointerByReference ppixdb);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_int32 pixCompareBinary(PIX*, PIX*, l_int32, l_float32*, PIX**)</code><br>
 * <i>native declaration : allheaders.h:1056</i>
 */
public static native int pixCompareBinary(Pix pix1, Pix pix2, int comptype, FloatByReference pfract, PointerByReference ppixdiff);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_int32 pixCompareGrayOrRGB(PIX*, PIX*, l_int32, l_int32, l_int32*, l_float32*, l_float32*, PIX**)</code><br>
 * <i>native declaration : allheaders.h:1058</i>
 */
public static native int pixCompareGrayOrRGB(Pix pix1, Pix pix2, int comptype, int plottype, IntByReference psame, FloatByReference pdiff, FloatByReference prmsdiff, PointerByReference ppixdiff);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_int32 pixCompareGray(PIX*, PIX*, l_int32, l_int32, l_int32*, l_float32*, l_float32*, PIX**)</code><br>
 * <i>native declaration : allheaders.h:1060</i>
 */
public static native int pixCompareGray(Pix pix1, Pix pix2, int comptype, int plottype, IntByReference psame, FloatByReference pdiff, FloatByReference prmsdiff, PointerByReference ppixdiff);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_int32 pixCompareRGB(PIX*, PIX*, l_int32, l_int32, l_int32*, l_float32*, l_float32*, PIX**)</code><br>
 * <i>native declaration : allheaders.h:1062</i>
 */
public static native int pixCompareRGB(Pix pix1, Pix pix2, int comptype, int plottype, IntByReference psame, FloatByReference pdiff, FloatByReference prmsdiff, PointerByReference ppixdiff);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature :
 * <code>l_int32 pixGetPerceptualDiff(PIX*, PIX*, l_int32, l_int32, l_int32, l_float32*, PIX**, PIX**)</code><br>
 * <i>native declaration : allheaders.h:1074</i>
 */
public static native int pixGetPerceptualDiff(Pix pixs1, Pix pixs2, int sampling, int dilation, int mindiff, FloatByReference pfract, PointerByReference ppixdiff1, PointerByReference ppixdiff2);
项目:lept4j    文件:Leptonica1.java   
/**
 * Original signature : <code>l_float32* fpixGetData(FPIX*)</code><br>
 * <i>native declaration : allheaders.h:1568</i>
 */
public static native FloatByReference fpixGetData(FPix fpix);