/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.twitter.ann.faiss;

public class PQEncoderGeneric {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected PQEncoderGeneric(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(PQEncoderGeneric obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        swigfaissJNI.delete_PQEncoderGeneric(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setCode(SWIGTYPE_p_unsigned_char value) {
    swigfaissJNI.PQEncoderGeneric_code_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
  }

  public SWIGTYPE_p_unsigned_char getCode() {
    long cPtr = swigfaissJNI.PQEncoderGeneric_code_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
  }

  public void setOffset(short value) {
    swigfaissJNI.PQEncoderGeneric_offset_set(swigCPtr, this, value);
  }

  public short getOffset() {
    return swigfaissJNI.PQEncoderGeneric_offset_get(swigCPtr, this);
  }

  public int getNbits() {
    return swigfaissJNI.PQEncoderGeneric_nbits_get(swigCPtr, this);
  }

  public void setReg(short value) {
    swigfaissJNI.PQEncoderGeneric_reg_set(swigCPtr, this, value);
  }

  public short getReg() {
    return swigfaissJNI.PQEncoderGeneric_reg_get(swigCPtr, this);
  }

  public PQEncoderGeneric(SWIGTYPE_p_unsigned_char code, int nbits, short offset) {
    this(swigfaissJNI.new_PQEncoderGeneric__SWIG_0(SWIGTYPE_p_unsigned_char.getCPtr(code), nbits, offset), true);
  }

  public PQEncoderGeneric(SWIGTYPE_p_unsigned_char code, int nbits) {
    this(swigfaissJNI.new_PQEncoderGeneric__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(code), nbits), true);
  }

  public void encode(long x) {
    swigfaissJNI.PQEncoderGeneric_encode(swigCPtr, this, x);
  }

}
