All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jogamp.oculusvr.ovrSensorDesc Maven / Gradle / Ivy

There is a newer version: 2.3.2
Show newest version
/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Thu Aug 07 00:34:50 CEST 2014 ----! */


package com.jogamp.oculusvr;

import java.nio.*;

import com.jogamp.gluegen.runtime.*;
import com.jogamp.common.os.*;
import com.jogamp.common.nio.*;
import jogamp.common.os.MachineDescriptionRuntime;

import com.jogamp.oculusvr.*;
import java.security.AccessController;
import java.security.PrivilegedAction;

public class ovrSensorDesc {

  StructAccessor accessor;

  private static final int mdIdx = MachineDescriptionRuntime.getStatic().ordinal();

  private static final int[] ovrSensorDesc_size = new int[] { 28 /* ARMle_EABI */, 28 /* X86_32_UNIX */, 28 /* X86_64_UNIX */, 28 /* X86_32_MACOS */, 28 /* X86_32_WINDOWS */, 28 /* X86_64_WINDOWS */, 28 /* SPARC_32_SUNOS */  };
  private static final int[] VendorId_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* X86_64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */, 0 /* SPARC_32_SUNOS */ };
//private static final int[] VendorId_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */  };
  private static final int[] ProductId_offset = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ };
//private static final int[] ProductId_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */  };
  private static final int[] SerialNumber_offset = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
  private static final int[] SerialNumber_size = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 24 /* X86_64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */, 24 /* SPARC_32_SUNOS */  };

  public static int size() {
    return ovrSensorDesc_size[mdIdx];
  }

  public static ovrSensorDesc create() {
    return create(Buffers.newDirectByteBuffer(size()));
  }

  public static ovrSensorDesc create(java.nio.ByteBuffer buf) {
      return new ovrSensorDesc(buf);
  }

  ovrSensorDesc(java.nio.ByteBuffer buf) {
    accessor = new StructAccessor(buf);
  }

  public java.nio.ByteBuffer getBuffer() {
    return accessor.getBuffer();
  }

  /** Setter for native field: CType['short', size [fixed true, lnx64 2], [int]] */
  public ovrSensorDesc setVendorId(short val) {
    accessor.setShortAt(VendorId_offset[mdIdx], val);
    return this;
  }

  /** Getter for native field: CType['short', size [fixed true, lnx64 2], [int]] */
  public short getVendorId() {
    return accessor.getShortAt(VendorId_offset[mdIdx]);
  }

  /** Setter for native field: CType['short', size [fixed true, lnx64 2], [int]] */
  public ovrSensorDesc setProductId(short val) {
    accessor.setShortAt(ProductId_offset[mdIdx], val);
    return this;
  }

  /** Getter for native field: CType['short', size [fixed true, lnx64 2], [int]] */
  public short getProductId() {
    return accessor.getShortAt(ProductId_offset[mdIdx]);
  }

  /** Getter for native field: CType['char *', size [fixed false, lnx64 24], [array*1]], with array length of 24 */
  public final int getSerialNumberArrayLength() {
    return 24;
  }

  /** Setter for native field: CType['char *', size [fixed false, lnx64 24], [array*1]], with array length of 24 */
  public ovrSensorDesc setSerialNumber(final int offset, byte[] val) {
    final int arrayLength = 24;
    if( offset + val.length > arrayLength ) { throw new IndexOutOfBoundsException("offset "+offset+" + val.length "+val.length+" > array-length "+arrayLength); };
    final int elemSize = Buffers.SIZEOF_BYTE;
    final ByteBuffer destB = getBuffer();
    final int bTotal = arrayLength * elemSize;
    if( bTotal > SerialNumber_size[mdIdx] ) { throw new IndexOutOfBoundsException("bTotal "+bTotal+" > size "+SerialNumber_size[mdIdx]+", elemSize "+elemSize+" * "+arrayLength); };
    int bOffset = SerialNumber_offset[mdIdx];
    final int bLimes = bOffset + bTotal;
    if( bLimes > destB.limit() ) { throw new IndexOutOfBoundsException("bLimes "+bLimes+" > buffer.limit "+destB.limit()+", elemOff "+bOffset+", elemSize "+elemSize+" * "+arrayLength); };
    bOffset += elemSize * offset;
    accessor.setBytesAt(bOffset, val);
    return this;
  }

  /** Getter for native field: CType['char *', size [fixed false, lnx64 24], [array*1]], with array length of 24 */
  public ByteBuffer getSerialNumber() {
    return accessor.slice(SerialNumber_offset[mdIdx],  Buffers.SIZEOF_BYTE * 24);
  }

  /** Getter for native field: CType['char *', size [fixed false, lnx64 24], [array*1]], with array length of 24 */
  public String getSerialNumberAsString() {
    final int offset = SerialNumber_offset[mdIdx];
    final int arrayLength = 24;
    final ByteBuffer bb = getBuffer();
    final byte[] ba = new byte[arrayLength];
    int i = -1;
    while( ++i < arrayLength ) {
      ba[i] = bb.get(offset+i);
      if( (byte)0 == ba[i] ) break;
    }
    return new String(ba, 0, i);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy