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

package com.nanotec.nanolib;

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

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

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

  protected static long swigRelease(ObjectDictionary obj) {
    long ptr = 0;
    if (obj != null) {
      if (!obj.swigCMemOwn)
        throw new RuntimeException("Cannot release ownership as memory is not owned");
      ptr = obj.swigCPtr;
      obj.swigCMemOwn = false;
      obj.delete();
    }
    return ptr;
  }

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

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

  public ObjectDictionary() {
    this(NanolibJNI.new_ObjectDictionary(), true);
  }

  public ResultString getXmlFileName() {
    return new ResultString(NanolibJNI.ObjectDictionary_getXmlFileName(swigCPtr, this), true);
  }

  public ResultDeviceHandle getDeviceHandle() {
    return new ResultDeviceHandle(NanolibJNI.ObjectDictionary_getDeviceHandle(swigCPtr, this), true);
  }

  public ResultObjectSubEntry getObject(OdIndex odIndex) {
    return new ResultObjectSubEntry(NanolibJNI.ObjectDictionary_getObject(swigCPtr, this, OdIndex.getCPtr(odIndex), odIndex), true);
  }

  public ResultObjectEntry getObjectEntry(int index) {
    return new ResultObjectEntry(NanolibJNI.ObjectDictionary_getObjectEntry(swigCPtr, this, index), true);
  }

  public ResultInt readNumber(OdIndex odIndex) {
    return new ResultInt(NanolibJNI.ObjectDictionary_readNumber(swigCPtr, this, OdIndex.getCPtr(odIndex), odIndex), true);
  }

  public ResultString readString(OdIndex odIndex) {
    return new ResultString(NanolibJNI.ObjectDictionary_readString(swigCPtr, this, OdIndex.getCPtr(odIndex), odIndex), true);
  }

  public ResultArrayByte readBytes(OdIndex odIndex) {
    return new ResultArrayByte(NanolibJNI.ObjectDictionary_readBytes(swigCPtr, this, OdIndex.getCPtr(odIndex), odIndex), true);
  }

  public ResultVoid writeNumber(OdIndex odIndex, long value) {
    return new ResultVoid(NanolibJNI.ObjectDictionary_writeNumber(swigCPtr, this, OdIndex.getCPtr(odIndex), odIndex, value), true);
  }

  public ResultVoid writeBytes(OdIndex odIndex, ByteVector data) {
    return new ResultVoid(NanolibJNI.ObjectDictionary_writeBytes(swigCPtr, this, OdIndex.getCPtr(odIndex), odIndex, ByteVector.getCPtr(data), data), true);
  }

  public ResultArrayInt readNumberArray(int index) {
    return new ResultArrayInt(NanolibJNI.ObjectDictionary_readNumberArray(swigCPtr, this, index), true);
  }

}
