001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 4.0.2
004 *
005 * Do not make changes to this file unless you know what you are doing--modify
006 * the SWIG interface file instead.
007 * ----------------------------------------------------------------------------- */
008
009package com.avpkit.ferry;
010
011/**
012 * Internal Only.  This object exists in order for the ferry test<br>
013 * libraries to test the memory management functionality<br>
014 * of the RefCounted class from Java.<br>
015 * <br>
016 * It is NOT part of the public API.
017 */
018public class RefCountedTester extends RefCounted {
019  // JNIHelper.swg: Start generated code
020  // >>>>>>>>>>>>>>>>>>>>>>>>>>>
021  /**
022   * This method is only here to use some references and remove
023   * a Eclipse compiler warning.
024   */
025  @SuppressWarnings("unused")
026  private void noop()
027  {
028    IBuffer.make(null, 1);
029  }
030   
031  private volatile long swigCPtr;
032
033  /**
034   * Internal Only.
035   */
036  protected RefCountedTester(long cPtr, boolean cMemoryOwn) {
037    super(FerryJNI.RefCountedTester_SWIGUpcast(cPtr), cMemoryOwn);
038    swigCPtr = cPtr;
039  }
040  
041  /**
042   * Internal Only.
043   */
044  protected RefCountedTester(long cPtr, boolean cMemoryOwn,
045      java.util.concurrent.atomic.AtomicLong ref)
046  {
047    super(FerryJNI.RefCountedTester_SWIGUpcast(cPtr),
048     cMemoryOwn, ref);
049    swigCPtr = cPtr;
050  }
051    
052  /**
053   * Internal Only.  Not part of public API.
054   *
055   * Get the raw value of the native object that obj is proxying for.
056   *   
057   * @param obj The java proxy object for a native object.
058   * @return The raw pointer obj is proxying for.
059   */
060  public static long getCPtr(RefCountedTester obj) {
061    if (obj == null) return 0;
062    return obj.getMyCPtr();
063  }
064
065  /**
066   * Internal Only.  Not part of public API.
067   *
068   * Get the raw value of the native object that we're proxying for.
069   *   
070   * @return The raw pointer we're proxying for.
071   */  
072  public long getMyCPtr() {
073    if (swigCPtr == 0) throw new IllegalStateException("underlying native object already deleted");
074    return swigCPtr;
075  }
076  
077  /**
078   * Create a new RefCountedTester object that is actually referring to the
079   * exact same underlying native object.
080   *
081   * @return the new Java object.
082   */
083  @Override
084  public RefCountedTester copyReference() {
085    if (swigCPtr == 0)
086      return null;
087    else
088      return new RefCountedTester(swigCPtr, swigCMemOwn, getJavaRefCount());
089  }
090
091  /**
092   * Compares two values, returning true if the underlying objects in native code are the same object.
093   *
094   * That means you can have two different Java objects, but when you do a comparison, you'll find out
095   * they are the EXACT same object.
096   *
097   * @return True if the underlying native object is the same.  False otherwise.
098   */
099  public boolean equals(Object obj) {
100    boolean equal = false;
101    if (obj instanceof RefCountedTester)
102      equal = (((RefCountedTester)obj).swigCPtr == this.swigCPtr);
103    return equal;
104  }
105  
106  /**
107   * Get a hashable value for this object.
108   *
109   * @return the hashable value.
110   */
111  public int hashCode() {
112     return (int)swigCPtr;
113  }
114  
115  // <<<<<<<<<<<<<<<<<<<<<<<<<<<
116  // JNIHelper.swg: End generated code
117  
118  public static RefCountedTester make() {
119    long cPtr = FerryJNI.RefCountedTester_make__SWIG_0();
120    return (cPtr == 0) ? null : new RefCountedTester(cPtr, false);
121  }
122
123  /**
124   * Acquires a reference to a passed in object,<br>
125   * and returns the new object.  This, when wrapped<br>
126   * by Swig, will be wrapped in a new Java object.
127   */
128  public static RefCountedTester make(RefCountedTester objToAcquire) {
129    long cPtr = FerryJNI.RefCountedTester_make__SWIG_1(RefCountedTester.getCPtr(objToAcquire), objToAcquire);
130    return (cPtr == 0) ? null : new RefCountedTester(cPtr, false);
131  }
132
133}