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 Base class for extending SBMLDocument in packages. 20 * 21 * @htmlinclude not-sbml-warning.html 22 * 23 * The SBMLDocumentPlugin class is a specialization of SBasePlugin 24 * designed specifically for extending SBMLDocument. All package 25 * extensions must extend SBMLDocument to implement support for SBML 26 * Level 3 packages; these extensions can be subclasses of this 27 * class or from a derived class of this class. 28 * 29 * All packages must additionally define a 30 * required flag named <code>required</code>, which indicates whether 31 * that package's constructs can be used to change the core mathematics of the 32 * <code><model></code> child of the <code><sbml></code> element. 33 * If they can, this attribute must be set @c true, and if they cannot, this 34 * attribute must be set @c false. 35 * 36 * @if clike 37 * @section sbmldocumentplugin-howto How to extend SBMLDocumentPlugin for a package implementation 38 * 39 * 40 * The following subsections detail the basic steps necessary to use 41 * SBMLDocumentPlugin to extend SBMLDocument for a given package extension. 42 * 43 * 44 * @subsection sdp-identify 1. Identify the changes necessary to SBMLDocument 45 * 46 * The specification for a SBML Level 3 package will define the 47 * changes to the SBML <code><sbml></code> element. Packages 48 * typically do not make any changes beyond adding an attribute named 49 * 'required' (discussed below), so in most cases, the extension of 50 * SBMLDocument is very simple. However, some packages do more. For 51 * instance, the Hierarchical %Model Composition package adds subobjects 52 * for lists of model definitions. SBMLDocumentPlugin supports all these 53 * cases. 54 * 55 * 56 * @subsection sdp-implement 2. Create the SBMLDocumentPlugin subclass 57 * 58 * A package extension will only define one subclass of SBMLDocumentPlugin. 59 * Below, we describe in detail the different parts of a subclass 60 * definition. 61 * 62 * 63 * @subsubsection sdp-class 2.1 Override SBasePlugin class-related methods 64 * 65 * The derived class must override the constructor, copy constructor, assignment 66 * operator (<code>operator=</code>) and <code>clone()</code> methods from 67 * SBasePlugin. 68 * 69 * 70 * @subsubsection sdp-required 2.2 Determine the necessary value of the 'required' attribute 71 * 72 * At minimum, it is necessary for a package implementation to add the 73 * 'required' attribute to the SBML <code><sbml></code> element 74 * mandated by SBML for all Level 3 packages, and this is done using 75 * this class as a base. If the 'required' attribute is the @em only 76 * addition necessary for a particular SBML Level 3 package, then the 77 * subclass of SBMLDocumentPlugin for the package can have a very simple 78 * implementation. Some Level 3 packages add additional attributes or 79 * elements to <code><sbml></code>, and their implementations would 80 * go into the subclassed SBMLDocumentPlugin. 81 * 82 * SBMLDocumentPlugin provides methods with default implementations that 83 * support managing the 'required' attribute, so package extension code 84 * does not need to provide implementations—they only need to set the 85 * correct value for the SBML Level 3 package based on its 86 * specification. The following are the virtual methods for working with 87 * the 'required' attribute. Package extensions would only need to 88 * override them in special circumstances: 89 * 90 * @li <code>setRequired(bool value)</code>: This method sets the value 91 * of the flag. 92 * 93 * @li <code>getRequired()</code>: This method gets the value of the 94 * 'required' flag. 95 * 96 * @li <code>isSetRequired()</code>: This method tests if the value has 97 * been set. 98 * 99 * @li <code>unsetRequired()</code>: This method unsets the value of the 100 * 'required' flag. 101 * 102 * 103 * @subsubsection sdp-protected 2.3 Define protected data members 104 * 105 * An extended SBMLDocument object may need more than just the 'required' 106 * attribute, depending on what is defined in the specification for the 107 * package being implemented. Data attributes on the extended 108 * <code><sbml></code> object in an SBML package will have one of the 109 * data types <code>string</code>, <code>double</code>, 110 * <code>int</code>, or <code>bool</code>. Subelements/subobjects will 111 * normally be derived from the ListOf class or from SBase. 112 * 113 * The additional data members must be properly initialized in the class 114 * constructor, and must be properly copied in the copy constructor and 115 * assignment operator. 116 * 117 * 118 * @subsubsection sdp-methods-attribs 2.4 Override virtual methods for attributes 119 * 120 * If the extended component is defined by the SBML Level 3 package to 121 * have attributes, then the extended SBMLDocumentPlugin class definition 122 * needs to override the following internal methods that come from 123 * SBasePlugin (the base class of SBMLDocumentPlugin) and provide 124 * appropriate implementations: 125 * 126 * @li <code>addExpectedAttributes(ExpectedAttributes& attributes)</code>: This 127 * method should add the attributes that are expected to be found on this kind 128 * of extended component in an SBML file or data stream. 129 * 130 * @li <code>readAttributes(XMLAttributes attributes, ExpectedAttributes& 131 * expectedAttributes)</code>: This method should read the attributes 132 * expected to be found on this kind of extended component in an SBML file or 133 * data stream. 134 * 135 * @li <code>hasRequiredAttributes()</code>: This method should return @c true 136 * if all of the required attribute for this extended component are present on 137 * instance of the object. 138 * 139 * @li <code>writeAttributes(XMLOutputStream stream)</code>: This method should 140 * write out the attributes of an extended component. The implementation should 141 * use the different kinds of <code>writeAttribute</code> methods defined by 142 * XMLOutputStream to achieve this. 143 * 144 * 145 * @subsubsection sdp-methods-elem 2.5 Override virtual methods for subcomponents 146 * 147 * If the extended component is defined by the Level 3 package to have 148 * subcomponents (i.e., full XML elements rather than mere attributes), 149 * then the extended class definition needs to override the following 150 * internal methods on SBasePlugin (the base class of SBMLDocumentPlugin) 151 * and provide appropriate implementations: 152 * 153 * @li <code>createObject(XMLInputStream stream)</code>: Subclasses must 154 * override this method to create, store, and then return an SBML object 155 * corresponding to the next XMLToken in the XMLInputStream. To do this, 156 * implementations can use methods like <code>peek()</code> on XMLInputStream to 157 * test if the next object in the stream is something expected for the package. 158 * For example, LayoutModelPlugin uses <code>peek()</code> to examine the next 159 * element in the input stream, then tests that element against the Layout 160 * namespace and the element name <code>'listOfLayouts'</code> to see if it's 161 * the single subcomponent (ListOfLayouts) permitted on a Model object using the 162 * Layout package. If it is, it returns the appropriate object. 163 * 164 * @li <code>connectToParent(SBase sbase)</code>: This creates a parent-child 165 * relationship between a given extended component and its subcomponent(s). 166 * 167 * @li <code>setSBMLDocument(SBMLDocument d)</code>: This method should set the 168 * parent SBMLDocument object on the subcomponent object instances, so that the 169 * subcomponent instances know which SBMLDocument contains them. 170 * 171 * @li <code>enablePackageInternal(string& pkgURI, string& pkgPrefix, 172 * bool flag)</code>: This method should enable or disable the subcomponent 173 * based on whether a given XML namespace is active. 174 * 175 * @li <code>writeElements(XMLOutputStream stream)</code>: This method must be 176 * overridden to provide an implementation that will write out the expected 177 * subcomponents/subelements to the XML output stream. 178 * 179 * @li <code>readOtherXML(SBase parentObject, XMLInputStream stream)</code>: 180 * This function should be overridden if elements of annotation, notes, MathML 181 * content, etc., need to be directly parsed from the given XMLInputStream 182 * object. 183 * 184 * @li <code>hasRequiredElements()</code>: This method should return @c true if 185 * a given object contains all the required subcomponents defined by the 186 * specification for that SBML Level 3 package. 187 * 188 * 189 * @subsubsection sdp-methods-xmlns 2.6 Override virtual methods for XML namespaces 190 * 191 * If the package needs to add additional <code>xmlns</code> attributes to 192 * declare additional XML namespace URIs, the extended class should 193 * override the following method coming from SBasePlugin (the parent class 194 * of SBMLDocumentPlugin): 195 * 196 * @li <code>writeXMLNS(XMLOutputStream stream)</code>: This method should 197 * write out any additional XML namespaces that might be needed by a package 198 * implementation. 199 * 200 * 201 * @subsubsection sdp-methods-hooks 2.7 Implement additional methods as needed 202 * 203 * Extended SBMLDocumentPlugin implementations can add whatever additional 204 * utility methods are useful for their implementation. 205 * 206 * 207 * @else 208 * 209 * @section ext-basics Basic principles of SBML package extensions in libSBML 210 * 211 * 212 * SBML Level 3's package structure permits modular extensions to the 213 * core SBML format. In libSBML, support for SBML Level 3 packages is 214 * provided through optional <em>package extensions</em> that can be plugged 215 * into libSBML at the time it is built/compiled. Users of libSBML can thus 216 * choose which extensions are enabled in their software applications. 217 * 218 * LibSBML defines a number of classes that developers of package extensions 219 * can use to implement support for an SBML Level 3 package. These 220 * classes make it easier to extend libSBML objects with new attributes 221 * and/or subobjects as needed by a particular Level 3 package. 222 * Three overall categories of classes make up libSBML's facilities for 223 * implementing package extensions. There are (1) classes that serve as base 224 * classes meant to be subclassed, (2) template classes meant to be 225 * instantiated rather than subclassed, and (3) support classes that provide 226 * utility features. A given package implementation for libSBML will take 227 * the form of code using these and other libSBML classes, placed in a 228 * subdirectory of <code>src/sbml/packages/</code>. 229 * 230 * The basic libSBML distribution includes a number of package extensions 231 * implementing support for officially-endorsed SBML Level 3 packages; 232 * among these are <em>Flux Balance Constraints</em> ('fbc'), 233 * <em>Hierarchical %Model Composition</em> ('comp'), <em>%Layout</em> 234 * ('layout'), and <em>Qualitative Models</em> ('qual'). They can serve as 235 * working examples for developers working to implement other packages. 236 * 237 * Extensions in libSBML can currently only be implemented in C++ or C; 238 * there is no mechanism to implement them first in languages such as 239 * Java or Python. However, once implemented in C++ or C, language 240 * interfaces can be generated semi-automatically using the framework in 241 * place in libSBML. (The approach is based on using <a target='_blank' 242 * href='http://www.swig.org'>SWIG</a> and facilities in libSBML's build 243 * system.) 244 * 245 * 246 * @endif 247 */ 248 249 public class SBMLDocumentPlugin : SBasePlugin { 250 private HandleRef swigCPtr; 251 SBMLDocumentPlugin(IntPtr cPtr, bool cMemoryOwn)252 internal SBMLDocumentPlugin(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.SBMLDocumentPlugin_SWIGUpcast(cPtr), cMemoryOwn) 253 { 254 //super(libsbmlPINVOKE.SBMLDocumentPluginUpcast(cPtr), cMemoryOwn); 255 swigCPtr = new HandleRef(this, cPtr); 256 } 257 getCPtr(SBMLDocumentPlugin obj)258 internal static HandleRef getCPtr(SBMLDocumentPlugin obj) 259 { 260 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 261 } 262 getCPtrAndDisown(SBMLDocumentPlugin obj)263 internal static HandleRef getCPtrAndDisown (SBMLDocumentPlugin obj) 264 { 265 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 266 267 if (obj != null) 268 { 269 ptr = obj.swigCPtr; 270 obj.swigCMemOwn = false; 271 } 272 273 return ptr; 274 } 275 Dispose(bool disposing)276 protected override void Dispose(bool disposing) { 277 lock(this) { 278 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 279 if (swigCMemOwn) { 280 swigCMemOwn = false; 281 libsbmlPINVOKE.delete_SBMLDocumentPlugin(swigCPtr); 282 } 283 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 284 } 285 base.Dispose(disposing); 286 } 287 } 288 289 290 /** 291 * Creates a new SBMLDocumentPlugin object using the given parameters. 292 * 293 * 294 * 295 * In the XML representation of an SBML document, XML namespaces are used to 296 * identify the origin of each XML construct used. XML namespaces are 297 * identified by their unique resource identifiers (URIs). The core SBML 298 * specifications stipulate the namespaces that must be used for core SBML 299 * constructs; for example, all XML elements that belong to SBML Level 3 300 * Version 1 Core must be placed in the XML namespace identified by the URI 301 * <code>'http://www.sbml.org/sbml/level3/version1/core'</code>. Individual 302 * SBML Level 3 packages define their own XML namespaces; for example, 303 * all elements belonging to the SBML Level 3 %Layout Version 1 304 * package must be placed in the XML namespace 305 * <code>'http://www.sbml.org/sbml/level3/version1/layout/version1/'</code>. 306 * 307 * 308 * 309 * 310 * 311 * The SBMLNamespaces object encapsulates SBML Level/Version/namespaces 312 * information. It is used to communicate the SBML Level, Version, and (in 313 * Level 3) packages used in addition to SBML Level 3 Core. A 314 * common approach to using libSBML's SBMLNamespaces facilities is to create an 315 * SBMLNamespaces object somewhere in a program once, then hand that object 316 * as needed to object constructors that accept SBMLNamespaces as arguments. 317 * 318 * 319 * 320 * @param uri the URI of the SBML Level 3 package implemented by 321 * this libSBML package extension. 322 * 323 * @param prefix the XML namespace prefix being used for the package. 324 * 325 * @param sbmlns the SBMLNamespaces object for the package. 326 */ public SBMLDocumentPlugin(string uri, string prefix, SBMLNamespaces sbmlns)327 SBMLDocumentPlugin(string uri, string prefix, SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_SBMLDocumentPlugin__SWIG_0(uri, prefix, SBMLNamespaces.getCPtr(sbmlns)), true) { 328 } 329 330 331 /** 332 * Copy constructor. 333 * 334 * This creates a copy of this object. 335 * 336 * @param orig the SBMLDocumentPlugin instance to copy. 337 */ public SBMLDocumentPlugin(SBMLDocumentPlugin orig)338 SBMLDocumentPlugin(SBMLDocumentPlugin orig) : this(libsbmlPINVOKE.new_SBMLDocumentPlugin__SWIG_1(SBMLDocumentPlugin.getCPtr(orig)), true) { 339 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 340 } 341 342 343 /** 344 * Creates and returns a deep copy of this SBMLDocumentPlugin object. 345 * 346 * @return the (deep) copy of this SBMLDocumentPlugin object. 347 */ public new clone()348 SBasePlugin clone() { 349 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocumentPlugin_clone(swigCPtr); 350 SBMLDocumentPlugin ret = (cPtr == global::System.IntPtr.Zero) ? null : new SBMLDocumentPlugin(cPtr, true); 351 return ret; 352 } 353 354 355 /** 356 * Sets the SBML 'required' attribute value. 357 * 358 * 359 * 360 * SBML Level 3 requires that every package defines an attribute named 361 * 'required' on the root <code><sbml></code> element in an SBML file 362 * or data stream. The attribute, being in the namespace of the Level 3 363 * package in question, must be prefixed by the XML namespace prefix 364 * associated with the package. The value of the 'required' attribute 365 * indicates whether constructs in that package may change the mathematical 366 * interpretation of constructs defined in SBML Level 3 Core. A 367 * 'required' value of @c true indicates that the package may do so. The 368 * value of the attribute is set by the Level 3 package specification, 369 * and does @em not depend on the actual presence or absence of particular 370 * package constructs in a given SBML document: in other words, if the 371 * package specification defines any construct that can change the model's 372 * meaning, the value of the 'required' attribute must always be set to 373 * @c true in any SBML document that uses the package. 374 * 375 * The XML namespace declaration for an SBML Level 3 package is an 376 * indication that a model makes use of features defined by that package, 377 * while the 'required' attribute indicates whether the features may be 378 * ignored without compromising the mathematical meaning of the model. Both 379 * are necessary for a complete reference to an SBML Level 3 package. 380 * 381 * 382 * 383 * @param value the value to be assigned to the 'required' attribute. 384 * The 'required' attribute takes a Boolean value, either @c true or 385 * @c false. 386 * 387 * 388 * @return integer value indicating success/failure of the 389 * function. @if clike The value is drawn from the 390 * enumeration #OperationReturnValues_t. @endif The possible values 391 * returned by this function are: 392 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 393 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 394 * 395 * @see getRequired() 396 * @see isSetRequired() 397 * @see unsetRequired() 398 */ public new setRequired(bool value)399 int setRequired(bool value) { 400 int ret = libsbmlPINVOKE.SBMLDocumentPlugin_setRequired(swigCPtr, value); 401 return ret; 402 } 403 404 405 /** 406 * Returns the value of the 'required' attribute. 407 * 408 * 409 * 410 * SBML Level 3 requires that every package defines an attribute named 411 * 'required' on the root <code><sbml></code> element in an SBML file 412 * or data stream. The attribute, being in the namespace of the Level 3 413 * package in question, must be prefixed by the XML namespace prefix 414 * associated with the package. The value of the 'required' attribute 415 * indicates whether constructs in that package may change the mathematical 416 * interpretation of constructs defined in SBML Level 3 Core. A 417 * 'required' value of @c true indicates that the package may do so. The 418 * value of the attribute is set by the Level 3 package specification, 419 * and does @em not depend on the actual presence or absence of particular 420 * package constructs in a given SBML document: in other words, if the 421 * package specification defines any construct that can change the model's 422 * meaning, the value of the 'required' attribute must always be set to 423 * @c true in any SBML document that uses the package. 424 * 425 * The XML namespace declaration for an SBML Level 3 package is an 426 * indication that a model makes use of features defined by that package, 427 * while the 'required' attribute indicates whether the features may be 428 * ignored without compromising the mathematical meaning of the model. Both 429 * are necessary for a complete reference to an SBML Level 3 package. 430 * 431 * 432 * 433 * @return the bool value of 'required' attribute for the SBML package. 434 * 435 * @see setRequired(bool value) 436 * @see isSetRequired() 437 * @see unsetRequired() 438 */ public new getRequired()439 bool getRequired() { 440 bool ret = libsbmlPINVOKE.SBMLDocumentPlugin_getRequired(swigCPtr); 441 return ret; 442 } 443 444 445 /** 446 * Returns the value of the 'required' attribute. 447 * 448 * 449 * 450 * SBML Level 3 requires that every package defines an attribute named 451 * 'required' on the root <code><sbml></code> element in an SBML file 452 * or data stream. The attribute, being in the namespace of the Level 3 453 * package in question, must be prefixed by the XML namespace prefix 454 * associated with the package. The value of the 'required' attribute 455 * indicates whether constructs in that package may change the mathematical 456 * interpretation of constructs defined in SBML Level 3 Core. A 457 * 'required' value of @c true indicates that the package may do so. The 458 * value of the attribute is set by the Level 3 package specification, 459 * and does @em not depend on the actual presence or absence of particular 460 * package constructs in a given SBML document: in other words, if the 461 * package specification defines any construct that can change the model's 462 * meaning, the value of the 'required' attribute must always be set to 463 * @c true in any SBML document that uses the package. 464 * 465 * The XML namespace declaration for an SBML Level 3 package is an 466 * indication that a model makes use of features defined by that package, 467 * while the 'required' attribute indicates whether the features may be 468 * ignored without compromising the mathematical meaning of the model. Both 469 * are necessary for a complete reference to an SBML Level 3 package. 470 * 471 * 472 * 473 * @return @c true if the 'required' attribute of this SBMLDocument 474 * has been set to @c true, @c false otherwise. 475 */ public new isSetRequired()476 bool isSetRequired() { 477 bool ret = libsbmlPINVOKE.SBMLDocumentPlugin_isSetRequired(swigCPtr); 478 return ret; 479 } 480 481 482 /** 483 * Unsets the value of the 'required' attribute of this SBMLDocumentPlugin. 484 * 485 * 486 * @return integer value indicating success/failure of the 487 * function. @if clike The value is drawn from the 488 * enumeration #OperationReturnValues_t. @endif The possible values 489 * returned by this function are: 490 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 491 */ public new unsetRequired()492 int unsetRequired() { 493 int ret = libsbmlPINVOKE.SBMLDocumentPlugin_unsetRequired(swigCPtr); 494 return ret; 495 } 496 497 498 /** */ /* libsbml-internal */ public new isCompFlatteningImplemented()499 bool isCompFlatteningImplemented() { 500 bool ret = libsbmlPINVOKE.SBMLDocumentPlugin_isCompFlatteningImplemented(swigCPtr); 501 return ret; 502 } 503 504 505 /** */ /* libsbml-internal */ public new checkConsistency()506 long checkConsistency() { return (long)libsbmlPINVOKE.SBMLDocumentPlugin_checkConsistency(swigCPtr); } 507 508 } 509 510 } 511