/* ----------------------------------------------------------------------------
 * 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 OnDiskInvertedListsIOHook {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

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

  protected static long getCPtr(OnDiskInvertedListsIOHook 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_OnDiskInvertedListsIOHook(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public OnDiskInvertedListsIOHook() {
    this(swigfaissJNI.new_OnDiskInvertedListsIOHook(), true);
  }

  public void write(InvertedLists ils, SWIGTYPE_p_IOWriter f) {
    swigfaissJNI.OnDiskInvertedListsIOHook_write(swigCPtr, this, InvertedLists.getCPtr(ils), ils, SWIGTYPE_p_IOWriter.getCPtr(f));
  }

  public InvertedLists read(SWIGTYPE_p_IOReader f, int io_flags) {
    long cPtr = swigfaissJNI.OnDiskInvertedListsIOHook_read(swigCPtr, this, SWIGTYPE_p_IOReader.getCPtr(f), io_flags);
    return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
  }

  public InvertedLists read_ArrayInvertedLists(SWIGTYPE_p_IOReader f, int io_flags, long nlist, long code_size, Uint64Vector sizes) {
    long cPtr = swigfaissJNI.OnDiskInvertedListsIOHook_read_ArrayInvertedLists(swigCPtr, this, SWIGTYPE_p_IOReader.getCPtr(f), io_flags, nlist, code_size, Uint64Vector.getCPtr(sizes), sizes);
    return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
  }

}
