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 CallbackRegistry : global::System.IDisposable { 14 private HandleRef swigCPtr; 15 protected bool swigCMemOwn; 16 CallbackRegistry(IntPtr cPtr, bool cMemoryOwn)17 internal CallbackRegistry(IntPtr cPtr, bool cMemoryOwn) 18 { 19 swigCMemOwn = cMemoryOwn; 20 swigCPtr = new HandleRef(this, cPtr); 21 } 22 getCPtr(CallbackRegistry obj)23 internal static HandleRef getCPtr(CallbackRegistry obj) 24 { 25 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 26 } 27 getCPtrAndDisown(CallbackRegistry obj)28 internal static HandleRef getCPtrAndDisown (CallbackRegistry 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 ~CallbackRegistry()41 ~CallbackRegistry() { 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_CallbackRegistry(swigCPtr); 56 } 57 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 58 } 59 } 60 } 61 62 63 /** 64 * Invokes all registered callbacks on the given document. If the callbacks indicate 65 * that processing should be stopped they return a value other than operation success. 66 * 67 * @return LIBSBML_OPERATION_SUCCESS to indicate that processing should be continued, 68 * any other value to stop processing 69 */ public invokeCallbacks(SBMLDocument doc)70 static int invokeCallbacks(SBMLDocument doc) { 71 int ret = libsbmlPINVOKE.CallbackRegistry_invokeCallbacks(SBMLDocument.getCPtr(doc)); 72 return ret; 73 } 74 75 76 /** 77 * Clears all registered processing callbacks 78 */ public clearCallbacks()79 static void clearCallbacks() { 80 libsbmlPINVOKE.CallbackRegistry_clearCallbacks(); 81 } 82 83 84 /** 85 * Registers a new processing callback that will be called with a newly instantiated 86 * ModelDefinition object. This allows for all post processing on it that needs to 87 * happen before integrating it with the target document. 88 * 89 * @param cb the callback. 90 */ public addCallback(Callback cb)91 static void addCallback(Callback cb) { 92 libsbmlPINVOKE.CallbackRegistry_addCallback(Callback.getCPtr(cb)); 93 } 94 95 96 /** 97 * @return the number of registered callbacks. 98 */ public getNumCallbacks()99 static int getNumCallbacks() { 100 int ret = libsbmlPINVOKE.CallbackRegistry_getNumCallbacks(); 101 return ret; 102 } 103 104 105 /** 106 * Removes the callback with given index. 107 * 108 * @param index the index of the callback to be removed from the list. 109 * 110 */ public removeCallback(int index)111 static void removeCallback(int index) { 112 libsbmlPINVOKE.CallbackRegistry_removeCallback__SWIG_0(index); 113 } 114 115 116 /** 117 * Removes the specified callback from the list of registered callbacks 118 * 119 * @param cb the callback to be removed. 120 */ public removeCallback(Callback cb)121 static void removeCallback(Callback cb) { 122 libsbmlPINVOKE.CallbackRegistry_removeCallback__SWIG_1(Callback.getCPtr(cb)); 123 } 124 125 } 126 127 } 128