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

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

/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Wed Mar 11 21:09:24 CET 2015 ----! */


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.MachineDataInfoRuntime;

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

public class ovrSensorDesc {

  StructAccessor accessor;

  private static final int mdIdx = MachineDataInfoRuntime.getStatic().ordinal();
  private final MachineDataInfo md;

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

  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) {
    md = MachineDataInfo.StaticConfig.values()[mdIdx].md;
    accessor = new StructAccessor(buf);
  }

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

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

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

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

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

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

  /** Setter for native field SerialNumber: CType[(ArrayType) 'char *', size [fixed false, lnx64 24], [const[false], 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 SerialNumber: CType[(ArrayType) 'char *', size [fixed false, lnx64 24], [const[false], array*1]], with array length of 24 */
  public ByteBuffer getSerialNumber() {
    return accessor.slice(SerialNumber_offset[mdIdx],  Buffers.SIZEOF_BYTE * 24);
  }

  /** Getter for native field SerialNumber: CType[(ArrayType) 'char *', size [fixed false, lnx64 24], [const[false], 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 - 2024 Weber Informatics LLC | Privacy Policy