1 using System; 2 using System.Runtime.InteropServices; 3 4 //------------------------------------------------------------------------------ 5 // <auto-generated /> 6 // 7 // This file was automatically generated by SWIG (http://www.swig.org). 8 // Version 4.0.2 9 // 10 // Do not make changes to this file unless you know what you are doing--modify 11 // the SWIG interface file instead. 12 //------------------------------------------------------------------------------ 13 14 namespace libsbmlcs { 15 16 public class CallbackRegistry : global::System.IDisposable { 17 private HandleRef swigCPtr; 18 protected bool swigCMemOwn; 19 CallbackRegistry(IntPtr cPtr, bool cMemoryOwn)20 internal CallbackRegistry(IntPtr cPtr, bool cMemoryOwn) 21 { 22 swigCMemOwn = cMemoryOwn; 23 swigCPtr = new HandleRef(this, cPtr); 24 } 25 getCPtr(CallbackRegistry obj)26 internal static HandleRef getCPtr(CallbackRegistry obj) 27 { 28 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 29 } 30 getCPtrAndDisown(CallbackRegistry obj)31 internal static HandleRef getCPtrAndDisown (CallbackRegistry obj) 32 { 33 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 34 35 if (obj != null) 36 { 37 ptr = obj.swigCPtr; 38 obj.swigCMemOwn = false; 39 } 40 41 return ptr; 42 } 43 ~CallbackRegistry()44 ~CallbackRegistry() { 45 Dispose(false); 46 } 47 Dispose()48 public void Dispose() { 49 Dispose(true); 50 global::System.GC.SuppressFinalize(this); 51 } 52 Dispose(bool disposing)53 protected virtual void Dispose(bool disposing) { 54 lock(this) { 55 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 56 if (swigCMemOwn) { 57 swigCMemOwn = false; 58 libsbmlPINVOKE.delete_CallbackRegistry(swigCPtr); 59 } 60 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 61 } 62 } 63 } 64 65 66 /** 67 * Invokes all registered callbacks on the given document. If the callbacks indicate 68 * that processing should be stopped they return a value other than operation success. 69 * 70 * @return LIBSBML_OPERATION_SUCCESS to indicate that processing should be continued, 71 * any other value to stop processing 72 */ public invokeCallbacks(SBMLDocument doc)73 static int invokeCallbacks(SBMLDocument doc) { 74 int ret = libsbmlPINVOKE.CallbackRegistry_invokeCallbacks(SBMLDocument.getCPtr(doc)); 75 return ret; 76 } 77 78 79 /** 80 * Clears all registered processing callbacks 81 */ public clearCallbacks()82 static void clearCallbacks() { 83 libsbmlPINVOKE.CallbackRegistry_clearCallbacks(); 84 } 85 86 87 /** 88 * Registers a new processing callback that will be called with a newly instantiated 89 * ModelDefinition object. This allows for all post processing on it that needs to 90 * happen before integrating it with the target document. 91 * 92 * @param cb the callback. 93 */ public addCallback(Callback cb)94 static void addCallback(Callback cb) { 95 libsbmlPINVOKE.CallbackRegistry_addCallback(Callback.getCPtr(cb)); 96 } 97 98 99 /** 100 * @return the number of registered callbacks. 101 */ public getNumCallbacks()102 static int getNumCallbacks() { 103 int ret = libsbmlPINVOKE.CallbackRegistry_getNumCallbacks(); 104 return ret; 105 } 106 107 108 /** 109 * Removes the callback with given index. 110 * 111 * @param index the index of the callback to be removed from the list. 112 * 113 */ public removeCallback(int index)114 static void removeCallback(int index) { 115 libsbmlPINVOKE.CallbackRegistry_removeCallback__SWIG_0(index); 116 } 117 118 119 /** 120 * Removes the specified callback from the list of registered callbacks 121 * 122 * @param cb the callback to be removed. 123 */ public removeCallback(Callback cb)124 static void removeCallback(Callback cb) { 125 libsbmlPINVOKE.CallbackRegistry_removeCallback__SWIG_1(Callback.getCPtr(cb)); 126 } 127 128 } 129 130 } 131