1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 4.0.2
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10 
11 namespace libsbml {
12 
13 public class Callback : global::System.IDisposable {
14 	private HandleRef swigCPtr;
15 	protected bool swigCMemOwn;
16 
Callback(IntPtr cPtr, bool cMemoryOwn)17 	internal Callback(IntPtr cPtr, bool cMemoryOwn)
18 	{
19 		swigCMemOwn = cMemoryOwn;
20 		swigCPtr    = new HandleRef(this, cPtr);
21 	}
22 
getCPtr(Callback obj)23 	internal static HandleRef getCPtr(Callback obj)
24 	{
25 		return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
26 	}
27 
getCPtrAndDisown(Callback obj)28 	internal static HandleRef getCPtrAndDisown (Callback obj)
29 	{
30 		HandleRef ptr = new HandleRef(null, IntPtr.Zero);
31 
32 		if (obj != null)
33 		{
34 			ptr             = obj.swigCPtr;
35 			obj.swigCMemOwn = false;
36 		}
37 
38 		return ptr;
39 	}
40 
~Callback()41   ~Callback() {
42     Dispose(false);
43   }
44 
Dispose()45   public void Dispose() {
46     Dispose(true);
47     global::System.GC.SuppressFinalize(this);
48   }
49 
Dispose(bool disposing)50   protected virtual void Dispose(bool disposing) {
51     lock(this) {
52       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
53         if (swigCMemOwn) {
54           swigCMemOwn = false;
55           libsbmlPINVOKE.delete_Callback(swigCPtr);
56         }
57         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
58       }
59     }
60   }
61 
62 
63 /**
64 	 * The processing function to be implemented by the callback
65 	 *
66 	 * In order to stop processing return a value other than
67 	 * LIBSBML_OPERATION_SUCCESS.
68 	 *
69 	 * @return LIBSBML_OPERATION_SUCCESS to continue the operations
70 	 *         any other value to stop
71 	 */ public new
process(SBMLDocument doc)72  int process(SBMLDocument doc) {
73     int ret = (SwigDerivedClassHasMethod("process", swigMethodTypes0) ? libsbmlPINVOKE.Callback_processSwigExplicitCallback(swigCPtr, SBMLDocument.getCPtr(doc)) : libsbmlPINVOKE.Callback_process(swigCPtr, SBMLDocument.getCPtr(doc)));
74     return ret;
75   }
76 
Callback()77   public Callback() : this(libsbmlPINVOKE.new_Callback(), true) {
78     SwigDirectorConnect();
79   }
80 
SwigDirectorConnect()81   private void SwigDirectorConnect() {
82     if (SwigDerivedClassHasMethod("process", swigMethodTypes0))
83       swigDelegate0 = new SwigDelegateCallback_0(SwigDirectorMethodprocess);
84     libsbmlPINVOKE.Callback_director_connect(swigCPtr, swigDelegate0);
85   }
86 
SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes)87   private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) {
88     global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null);
89     bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(Callback));
90     return hasDerivedMethod;
91   }
92 
SwigDirectorMethodprocess(global::System.IntPtr doc)93   private int SwigDirectorMethodprocess(global::System.IntPtr doc) {
94     return process((doc == global::System.IntPtr.Zero) ? null : new SBMLDocument(doc, false));
95   }
96 
SwigDelegateCallback_0(global::System.IntPtr doc)97   public delegate int SwigDelegateCallback_0(global::System.IntPtr doc);
98 
99   private SwigDelegateCallback_0 swigDelegate0;
100 
101   private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(SBMLDocument) };
102 }
103 
104 }
105