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 using System; 14 using System.Runtime.InteropServices; 15 16 /** 17 * @sbmlpackage{core} 18 * 19 @htmlinclude pkg-marker-core.html Log of diagnostics reported during processing. 20 * 21 * @htmlinclude not-sbml-warning.html 22 * 23 * The error log is a list. Each SBMLDocument maintains its own 24 * SBMLErrorLog. When a libSBML operation on SBML content results in an 25 * error, or when there is something worth noting about the SBML content, 26 * the issue is reported as an SBMLError object stored in the SBMLErrorLog 27 * list. 28 * 29 * SBMLErrorLog is derived from XMLErrorLog, an object class that serves 30 * exactly the same purpose but for the XML parsing layer. XMLErrorLog 31 * provides crucial methods such as 32 * @if java XMLErrorLog::getNumErrors()@else getNumErrors()@endif 33 * for determining how many SBMLError or XMLError objects are in the log. 34 * SBMLErrorLog inherits these methods. 35 * 36 * The general approach to working with SBMLErrorLog in user programs 37 * involves first obtaining a pointer to a log from a libSBML object such 38 * as SBMLDocument. Callers should then use 39 * @if java XMLErrorLog::getNumErrors()@else getNumErrors() @endif to inquire how 40 * many objects there are in the list. (The answer may be 0.) If there is 41 * at least one SBMLError object in the SBMLErrorLog instance, callers can 42 * then iterate over the list using 43 * SBMLErrorLog::getError(@if java long n@endif)@if clike @endif, 44 * using methods provided by the SBMLError class to find out the error code 45 * and associated information such as the error severity, the message, and 46 * the line number in the input. 47 * 48 * If you wish to simply print the error strings for a human to read, an 49 * easier and more direct way might be to use SBMLDocument::printErrors(). 50 * 51 * @see SBMLError 52 * @see XMLErrorLog 53 * @see XMLError 54 */ 55 56 public class SBMLErrorLog : XMLErrorLog { 57 private HandleRef swigCPtr; 58 SBMLErrorLog(IntPtr cPtr, bool cMemoryOwn)59 internal SBMLErrorLog(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.SBMLErrorLog_SWIGUpcast(cPtr), cMemoryOwn) 60 { 61 //super(libsbmlPINVOKE.SBMLErrorLogUpcast(cPtr), cMemoryOwn); 62 swigCPtr = new HandleRef(this, cPtr); 63 } 64 getCPtr(SBMLErrorLog obj)65 internal static HandleRef getCPtr(SBMLErrorLog obj) 66 { 67 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 68 } 69 getCPtrAndDisown(SBMLErrorLog obj)70 internal static HandleRef getCPtrAndDisown (SBMLErrorLog obj) 71 { 72 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 73 74 if (obj != null) 75 { 76 ptr = obj.swigCPtr; 77 obj.swigCMemOwn = false; 78 } 79 80 return ptr; 81 } 82 Dispose(bool disposing)83 protected override void Dispose(bool disposing) { 84 lock(this) { 85 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 86 if (swigCMemOwn) { 87 swigCMemOwn = false; 88 libsbmlPINVOKE.delete_SBMLErrorLog(swigCPtr); 89 } 90 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 91 } 92 base.Dispose(disposing); 93 } 94 } 95 96 97 /** 98 * Returns the <i>n</i>th SBMLError object in this log. 99 * 100 * Index @p n is counted from 0. Callers should first inquire about the 101 * number of items in the log by using the 102 * @if java XMLErrorLog::getNumErrors()@else getNumErrors()@endif method. 103 * Attempts to use an error index number that exceeds the actual number 104 * of errors in the log will result in a @c null being returned. 105 * 106 * @param n the index number of the error to retrieve (with 0 being the 107 * first error). 108 * 109 * @return the <i>n</i>th SBMLError in this log, or @c null if @p n is 110 * greater than or equal to 111 * @if java XMLErrorLog::getNumErrors()@else getNumErrors()@endif. 112 * 113 * @see getNumErrors() 114 */ public new getError(long n)115 SBMLError getError(long n) { 116 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLErrorLog_getError(swigCPtr, n); 117 SBMLError ret = (cPtr == global::System.IntPtr.Zero) ? null : new SBMLError(cPtr, false); 118 return ret; 119 } 120 121 122 /** 123 * Returns the <i>n</i>th SBMLError object with given severity in this log. 124 * 125 * Index @p n is counted from 0. Callers should first inquire about the 126 * number of items in the log by using the 127 * @if java SBMLErrorLog::getNumFailsWithSeverity(long severity)@else getNumFailsWithSeverity()@endif method. 128 * Attempts to use an error index number that exceeds the actual number 129 * of errors in the log will result in a @c null being returned. 130 * 131 * @param n the index number of the error to retrieve (with 0 being the 132 * first error). 133 * @param severity the severity of the error to retrieve. 134 * 135 * @return the <i>n</i>th SBMLError in this log, or @c null if @p n is 136 * greater than or equal to 137 * @if java SBMLErrorLog::getNumFailsWithSeverity(long severity)@else getNumFailsWithSeverity()@endif. 138 * 139 * @see getNumFailsWithSeverity(unsigned int severity) 140 */ public getErrorWithSeverity(long n, long severity)141 SBMLError getErrorWithSeverity(long n, long severity) { 142 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLErrorLog_getErrorWithSeverity(swigCPtr, n, severity); 143 SBMLError ret = (cPtr == global::System.IntPtr.Zero) ? null : new SBMLError(cPtr, false); 144 return ret; 145 } 146 147 148 /** 149 * Returns the number of errors that have been logged with the given 150 * severity code. 151 * 152 * 153 * 154 * LibSBML associates severity levels with every SBMLError object to 155 * provide an indication of how serious the problem is. Severities range 156 * from informational diagnostics to fatal (irrecoverable) errors. Given 157 * an SBMLError object instance, a caller can interrogate it for its 158 * severity level using methods such as SBMLError::getSeverity(), 159 * SBMLError::isFatal(), and so on. The present method encapsulates 160 * iteration and interrogation of all objects in an SBMLErrorLog, making 161 * it easy to check for the presence of error objects with specific 162 * severity levels. 163 * 164 * 165 * @if clike @param severity a value from 166 * #SBMLErrorSeverity_t @endif@if java @param severity a 167 * value from the set of <code>LIBSBML_SEV_</code> constants defined by 168 * the interface class <code><a 169 * href='libsbml.libsbml.html'>libsbmlConstants</a></code> @endif@if python @param severity a 170 * value from the set of <code>LIBSBML_SEV_</code> constants defined by 171 * the interface class @link libsbml libsbml@endlink. @endif 172 * 173 * @return a count of the number of errors with the given severity code. 174 * 175 * @see getNumErrors() 176 */ public getNumFailsWithSeverity(long severity)177 long getNumFailsWithSeverity(long severity) { return (long)libsbmlPINVOKE.SBMLErrorLog_getNumFailsWithSeverity__SWIG_0(swigCPtr, severity); } 178 179 180 /** */ /* libsbml-internal */ public SBMLErrorLog()181 SBMLErrorLog() : this(libsbmlPINVOKE.new_SBMLErrorLog__SWIG_0(), true) { 182 } 183 184 185 /** */ /* libsbml-internal */ public SBMLErrorLog(SBMLErrorLog orig)186 SBMLErrorLog(SBMLErrorLog orig) : this(libsbmlPINVOKE.new_SBMLErrorLog__SWIG_1(SBMLErrorLog.getCPtr(orig)), true) { 187 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 188 } 189 190 191 /** */ /* libsbml-internal */ public logError(long errorId, long level, long version, string details, long line, long column, long severity, long category)192 void logError(long errorId, long level, long version, string details, long line, long column, long severity, long category) { 193 libsbmlPINVOKE.SBMLErrorLog_logError__SWIG_0(swigCPtr, errorId, level, version, details, line, column, severity, category); 194 } 195 196 197 /** */ /* libsbml-internal */ public logError(long errorId, long level, long version, string details, long line, long column, long severity)198 void logError(long errorId, long level, long version, string details, long line, long column, long severity) { 199 libsbmlPINVOKE.SBMLErrorLog_logError__SWIG_1(swigCPtr, errorId, level, version, details, line, column, severity); 200 } 201 202 203 /** */ /* libsbml-internal */ public logError(long errorId, long level, long version, string details, long line, long column)204 void logError(long errorId, long level, long version, string details, long line, long column) { 205 libsbmlPINVOKE.SBMLErrorLog_logError__SWIG_2(swigCPtr, errorId, level, version, details, line, column); 206 } 207 208 209 /** */ /* libsbml-internal */ public logError(long errorId, long level, long version, string details, long line)210 void logError(long errorId, long level, long version, string details, long line) { 211 libsbmlPINVOKE.SBMLErrorLog_logError__SWIG_3(swigCPtr, errorId, level, version, details, line); 212 } 213 214 215 /** */ /* libsbml-internal */ public logError(long errorId, long level, long version, string details)216 void logError(long errorId, long level, long version, string details) { 217 libsbmlPINVOKE.SBMLErrorLog_logError__SWIG_4(swigCPtr, errorId, level, version, details); 218 } 219 220 221 /** */ /* libsbml-internal */ public logError(long errorId, long level, long version)222 void logError(long errorId, long level, long version) { 223 libsbmlPINVOKE.SBMLErrorLog_logError__SWIG_5(swigCPtr, errorId, level, version); 224 } 225 226 227 /** */ /* libsbml-internal */ public logError(long errorId, long level)228 void logError(long errorId, long level) { 229 libsbmlPINVOKE.SBMLErrorLog_logError__SWIG_6(swigCPtr, errorId, level); 230 } 231 232 233 /** */ /* libsbml-internal */ public logError(long errorId)234 void logError(long errorId) { 235 libsbmlPINVOKE.SBMLErrorLog_logError__SWIG_7(swigCPtr, errorId); 236 } 237 238 239 /** */ /* libsbml-internal */ public logError()240 void logError() { 241 libsbmlPINVOKE.SBMLErrorLog_logError__SWIG_8(swigCPtr); 242 } 243 244 245 /** */ /* libsbml-internal */ public logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details, long line, long column, long severity, long category)246 void logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details, long line, long column, long severity, long category) { 247 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_0(swigCPtr, package, errorId, pkgVersion, level, version, details, line, column, severity, category); 248 } 249 250 251 /** */ /* libsbml-internal */ public logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details, long line, long column, long severity)252 void logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details, long line, long column, long severity) { 253 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_1(swigCPtr, package, errorId, pkgVersion, level, version, details, line, column, severity); 254 } 255 256 257 /** */ /* libsbml-internal */ public logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details, long line, long column)258 void logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details, long line, long column) { 259 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_2(swigCPtr, package, errorId, pkgVersion, level, version, details, line, column); 260 } 261 262 263 /** */ /* libsbml-internal */ public logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details, long line)264 void logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details, long line) { 265 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_3(swigCPtr, package, errorId, pkgVersion, level, version, details, line); 266 } 267 268 269 /** */ /* libsbml-internal */ public logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details)270 void logPackageError(string package, long errorId, long pkgVersion, long level, long version, string details) { 271 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_4(swigCPtr, package, errorId, pkgVersion, level, version, details); 272 } 273 274 275 /** */ /* libsbml-internal */ public logPackageError(string package, long errorId, long pkgVersion, long level, long version)276 void logPackageError(string package, long errorId, long pkgVersion, long level, long version) { 277 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_5(swigCPtr, package, errorId, pkgVersion, level, version); 278 } 279 280 281 /** */ /* libsbml-internal */ public logPackageError(string package, long errorId, long pkgVersion, long level)282 void logPackageError(string package, long errorId, long pkgVersion, long level) { 283 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_6(swigCPtr, package, errorId, pkgVersion, level); 284 } 285 286 287 /** */ /* libsbml-internal */ public logPackageError(string package, long errorId, long pkgVersion)288 void logPackageError(string package, long errorId, long pkgVersion) { 289 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_7(swigCPtr, package, errorId, pkgVersion); 290 } 291 292 293 /** */ /* libsbml-internal */ public logPackageError(string package, long errorId)294 void logPackageError(string package, long errorId) { 295 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_8(swigCPtr, package, errorId); 296 } 297 298 299 /** */ /* libsbml-internal */ public logPackageError(string package)300 void logPackageError(string package) { 301 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_9(swigCPtr, package); 302 } 303 304 305 /** */ /* libsbml-internal */ public logPackageError()306 void logPackageError() { 307 libsbmlPINVOKE.SBMLErrorLog_logPackageError__SWIG_10(swigCPtr); 308 } 309 310 311 /** */ /* libsbml-internal */ public add(SBMLError error)312 void add(SBMLError error) { 313 libsbmlPINVOKE.SBMLErrorLog_add(swigCPtr, SBMLError.getCPtr(error)); 314 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 315 } 316 317 318 /** 319 * Removes an error having errorId from the SBMLError list. 320 * 321 * Only the first item will be removed if there are multiple errors 322 * with the given errorId. 323 * 324 * @param errorId the error identifier of the error to be removed. 325 */ public remove(long errorId)326 void remove(long errorId) { 327 libsbmlPINVOKE.SBMLErrorLog_remove(swigCPtr, errorId); 328 } 329 330 331 /** 332 * Removes all errors having errorId from the SBMLError list. 333 * 334 * @param errorId the error identifier of the error to be removed. 335 */ public removeAll(long errorId)336 void removeAll(long errorId) { 337 libsbmlPINVOKE.SBMLErrorLog_removeAll(swigCPtr, errorId); 338 } 339 340 341 /** 342 * Returns @c true if SBMLErrorLog contains an errorId 343 * 344 * @param errorId the error identifier of the error to be found. 345 */ public contains(long errorId)346 bool contains(long errorId) { 347 bool ret = libsbmlPINVOKE.SBMLErrorLog_contains(swigCPtr, errorId); 348 return ret; 349 } 350 351 } 352 353 } 354