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 SBML Level 3 package plug-ins.
20  *
21  * @htmlinclude not-sbml-warning.html
22  *
23  * The SBMLExtension class is a component of the libSBML package extension
24  * mechanism.  It is an abstract class that is extended by each package
25  * extension implementation. @if clike The SBMLExtension class provides
26  * methods for managing common attributes of package extensions (e.g.,
27  * package name, package version), registration of instantiated
28  * SBasePluginCreator objects, and initialization/registration of package
29  * extensions when the library code for the package is loaded. @endif
30  *
31  * @if clike
32  * @section sbmlextension-howto How to extend SBMLExtension for a package implementation
33  *
34  *
35  * Each package implementation must contain a class that extends
36  * SBMLExtension.  For example, the class <code>GroupsExtension</code> serves
37  * this purpose for the SBML Level&nbsp;3 @em Groups package extension in
38  * libSBML. The following subsections detail the basic steps involved in
39  * implementing such an extended class.
40  *
41  * @subsection ext-getpackagename 1. Define the getPackageName() method
42  *
43  * Define a method named <code>getPackageName()</code> that returns the
44  * name of the package as a string.  The following is an example from the
45  * implementation of the Groups package extension:
46 @code{.cpp}
47 string GroupsExtension::getPackageName ()
48 {
49       static string pkgName = 'groups';
50       return pkgName;
51 }
52 @endcode
53  *
54  *
55  * @subsection ext-version-methods 2. Define methods returning package version information
56  *
57  * Define a set of methods that return the default SBML Level, SBML
58  * Version and version of the package.  These methods must be named
59  * <code>getDefaultLevel()</code>, <code>getDefaultVersion()</code> and
60  * <code>getDefaultPackageVersion()</code>, respectively.  The following
61  * are examples drawn from the Groups package implementation:
62 @code{.cpp}
63 unsigned int GroupsExtension::getDefaultLevel()
64 {
65       return 3;
66 }
67 unsigned int GroupsExtension::getDefaultVersion()
68 {
69       return 1;
70 }
71 unsigned int GroupsExtension::getDefaultPackageVersion()
72 {
73       return 1;
74 }
75 @endcode
76  *
77  *
78  * @subsection ext-ns 3. Define methods returning the package namespace URIs
79  *
80  * Define methods that return strings representing the XML namespace URI
81  * for the package.  One method should be defined for each SBML Level/Version
82  * combination for which the package can be used.  For instance, if a package
83  * is only usable in SBML Level&nbsp;3 Version&nbsp;1, and the libSBML
84  * extension for the package implements version&nbsp;1 of the package, the
85  * necessary method is <code>getXmlnsL3V1V1()</code>.
86 @code{.cpp}
87 string GroupsExtension::getXmlnsL3V1V1 ()
88 {
89       static string xmlns = 'http://www.sbml.org/sbml/level3/version1/groups/version1';
90       return xmlns;
91 }
92 @endcode
93  *
94  * Define other similar methods to return additional namespace URIs if the
95  * package extension implements other package versions or supports other SBML
96  * Level/Version combinations.
97  *
98  *
99  * @subsection ext-virtual 4. Override basic pure virtual methods
100  *
101  * Override the following pure virtual methods on SBMLExtension:
102  *
103  * @li <code>virtual string getName() =0</code>. This
104  * method returns the nickname of the package (e.g., 'layout',
105  * 'groups').
106  *
107  * @li <code>virtual unsigned int getLevel(string &uri)
108  * =0</code>. This method returns the SBML Level with the given URI of
109  * this package.
110  *
111  * @li <code>virtual unsigned int getVersion(string &uri)
112  * =0</code>. This method returns the SBML Version with the given
113  * URI of this package.
114  *
115  * @li <code>virtual unsigned int getPackageVersion(string
116  * &uri) =0</code>. This method returns the package version with
117  * the given URI of this package.
118  *
119  * @li <code>virtual unsigned int getURI(unsigned int sbmlLevel,
120  * unsigned int sbmlVersion, unsigned int pkgVersion) =0</code>.
121  * This method returns the URI (namespace) of the package corresponding
122  * to the combination of the given SBML Level, SBML Version, and package
123  * version
124  *
125  * @li <code>virtual SBMLExtension clone() = 0</code>. This
126  * method creates and returns a deep copy of this derived object.
127  *
128  * As an example, the following are the versions of these methods for
129  * the Groups package:
130  * @code{.cpp}
131 string GroupsExtension::getName()
132 {
133   return getPackageName();
134 }
135 
136 unsigned int GroupsExtension::getLevel(string &uri)
137 {
138   if (uri == getXmlnsL3V1V1())
139     return 3;
140   else
141     return 0;
142 }
143 
144 unsigned int GroupsExtension::getVersion(string &uri)
145 {
146   if (uri == getXmlnsL3V1V1())
147     return 1;
148   else
149     return 0;
150 }
151 
152 unsigned int GroupsExtension::getPackageVersion(string &uri)
153 {
154   if (uri == getXmlnsL3V1V1())
155     return 1;
156   else
157     return 0;
158 }
159 
160 string GroupsExtension::getURI(unsigned int sbmlLevel,
161                                            unsigned int sbmlVersion,
162                                            unsigned int pkgVersion)
163 {
164   if (sbmlLevel == 3 && sbmlVersion == 1 && pkgVersion == 1)
165     return getXmlnsL3V1V1();
166 
167   static string empty = '';
168   return empty;
169 }
170 
171 GroupsExtension* GroupsExtension::clone()
172 {
173   return new GroupsExtension(*this);
174 }
175 @endcode
176  *
177  * Constructor, copy constructor, and destructor methods also must be
178  * overridden if additional data members are defined in the derived class.
179  *
180  *
181  * @subsection ext-typedef 5. Create SBMLExtensionNamespaces-related definitions
182  *
183  * Define typedef and template instantiation code for a package-specific
184  * subclass of the SBMLExtensionNamespaces template class.  The
185  * SBMLExtensionNamespaces template class is a derived class of
186  * SBMLNamespaces and can be used as an argument of constructors of
187  * SBase-derived classes defined in the package extensions.
188  *
189  * <ol>
190  *
191  * <li> Define a typedef.  For example, the typedef for
192  * <code>GroupsExtension</code> is implemented in the file
193  * <code>GroupsExtension.h</code> as follows:
194 @code{.cpp}
195 // GroupsPkgNamespaces is derived from the SBMLNamespaces class.
196 // It is used when creating a Groups package object of a class
197 // derived from SBase.
198 typedef SBMLExtensionNamespaces<GroupsExtension> GroupsPkgNamespaces;
199 @endcode
200  * </li>
201  *
202  * <li> Define a template instantiation for the typedef.  For example, the
203  * template instantiation code for <code>GroupsExtension is</code> implemented
204  * in the file <code>GroupsExtension.cpp</code> as follows:
205 @code{.cpp}
206 template class LIBSBML_EXTERN SBMLExtensionNamespaces<GroupsExtension>;
207 @endcode
208  * </li>
209  *
210  * </ol>
211  *
212  * Here is example of how the resulting class is used.  The definitions above
213  * allow a <code>GroupsPkgNamespaces</code> object to be used when creating a
214  * new <code>Group</code> object.  The <code>GroupsPkgNamespaces</code> is
215  * handed to the constructor as an argument, as shown below:
216 @code{.cpp}
217 GroupPkgNamespaces gpns(3, 1, 1);  // SBML Level, Version, & pkg version.
218 Group g = new Group(&gpns);        // Creates a Group object.
219 @endcode
220  *
221  * The <code>GroupsPkgNamespaces</code> object can also be used when creating
222  * an SBMLDocument object with the Groups package.  The code fragment
223  * below shows an example of this:
224 @code{.cpp}
225    GroupsPkgNamespaces gpns(3, 1, 1);
226    SBMLDocument doc;
227    doc  = new SBMLDocument(&gnps);
228 @endcode
229  *
230  *
231  * @subsection ext-virtual-ns 6. Override the method getSBMLExtensionNamespaces()
232  *
233  * Override the pure virtual method <code>getSBMLExtensionNamespaces()</code>,
234  * which returns an SBMLNamespaces derived object.  For example, the method
235  * is overridden in the class <code>GroupsExtension</code> as follows:
236 @code{.cpp}
237 SBMLNamespaces
238 GroupsExtension::getSBMLExtensionNamespaces(string &uri)
239 {
240   GroupsPkgNamespaces* pkgns = null;
241   if ( uri == getXmlnsL3V1V1())
242   {
243     pkgns = new GroupsPkgNamespaces(3, 1, 1);
244   }
245   return pkgns;
246 }
247 @endcode
248  *
249  *
250  * @subsection ext-enum 7. Define an enumeration for the package object type codes
251  *
252  * Define an enum type for representing the type code of the objects defined
253  * in the package extension.  For example, the enumeration
254  * <code>SBMLGroupsTypeCode_t</code> for the Groups package is defined in
255  * <code>GroupsExtension.h</code> as follows:
256 @code{.cpp}
257 typedef enum
258 {
259    SBML_GROUPS_GROUP  = 500
260  , SBML_GROUPS_MEMBER = 501
261 } SBMLGroupsTypeCode_t;
262 @endcode
263  *
264  * In the enumeration above, <code>SBML_GROUPS_GROUP</code> corresponds to
265  * the <code>Group</code> class (for the <code>&lt;group&gt;</code> element
266  * defined by the SBML Level&nbsp;3 Groups package) and
267  * <code>SBML_GROUPS_MEMBER</code> corresponds to the <code>Member</code>
268  * class (for the <code>&lt;member&gt;</code> element defined by the
269  * Level&nbsp;3 Groups package), respectively.
270  *
271  * Similarly, #SBMLLayoutTypeCode_t for the Layout package is defined in
272  * the file <code>LayoutExtension.h</code> as follows:
273  *
274 @code{.cpp}
275 typedef enum
276 {
277    SBML_LAYOUT_BOUNDINGBOX           = 100
278  , SBML_LAYOUT_COMPARTMENTGLYPH      = 101
279  , SBML_LAYOUT_CUBICBEZIER           = 102
280  , SBML_LAYOUT_CURVE                 = 103
281  , SBML_LAYOUT_DIMENSIONS            = 104
282  , SBML_LAYOUT_GRAPHICALOBJECT       = 105
283  , SBML_LAYOUT_LAYOUT                = 106
284  , SBML_LAYOUT_LINESEGMENT           = 107
285  , SBML_LAYOUT_POINT                 = 108
286  , SBML_LAYOUT_REACTIONGLYPH         = 109
287  , SBML_LAYOUT_SPECIESGLYPH          = 110
288  , SBML_LAYOUT_SPECIESREFERENCEGLYPH = 111
289  , SBML_LAYOUT_TEXTGLYPH             = 112
290 } SBMLLayoutTypeCode_t;
291 @endcode
292  *
293  * These enum values are returned by corresponding <code>getTypeCode()</code>
294  * methods.  (E.g., <code>SBML_GROUPS_GROUP</code> is returned in
295  * <code>Group::getTypeCode()</code>.)
296  *
297  * Note that libSBML does not require that type codes are unique across all
298  * packages&mdash;the same type codes may be used within individual package
299  * extensions.  LibSBML development must permit this because package
300  * implementations are developed by separate groups at different times;
301  * coordinating the type codes used is impractical.  It does mean that
302  * callers must check two things when identifying objects: to distinguish the
303  * type codes of different packages, callers much check not only the return
304  * value of the method <code>getTypeCode()</code> method but also that of the
305  * method <code>getPackageName()</code>.  Here is an example of doing that:
306 @code{.cpp}
307 void example (SBase sb)
308 {
309   string pkgName = sb->getPackageName();
310   if (pkgName == 'core') {
311     switch (sb->getTypeCode()) {
312       case SBML_MODEL:
313          ....
314          break;
315       case SBML_REACTION:
316          ....
317     }
318   }
319   else if (pkgName == 'layout') {
320     switch (sb->getTypeCode()) {
321       case SBML_LAYOUT_LAYOUT:
322          ....
323          break;
324       case SBML_LAYOUT_REACTIONGLYPH:
325          ....
326     }
327   }
328   else if (pkgName == 'groups') {
329     switch (sb->getTypeCode()) {
330       case SBML_GROUPS_GROUP:
331          ....
332          break;
333       case SBML_GROUPS_MEMBER:
334          ....
335     }
336   }
337   ...
338 }
339 @endcode
340  *
341  * Readers may have noticed that in the #SBMLLayoutTypeCode_t and
342  * <code>SBMLGroupsTypeCode_t</code> enumerations above, unique values
343  * are in fact assigned to the enumeration values.  This can be convenient
344  * when it can be arranged, but it is not required by libSBML.
345  *
346  *
347  * @subsection ext-virtual-typecodes 8. Override the method getStringFromTypeCode()
348  *
349  * Override the pure virtual method <code>getStringFromTypeCode()</code>,
350  * which returns a string corresponding to the given type code.  Here is an
351  * example, again drawn from the implementation of the Groups package:
352 @code{.cpp}
353 virtual string SBMLExtension::(int typeCode) ;
354 @endcode
355  *
356  * For example, the method for the Groups extension is implemented as
357  * shown below:
358 @code{.cpp}
359 static string SBML_GROUPS_TYPECODE_STRINGS[] =
360 {
361     'Group'
362   , 'Member'
363 };
364 
365 string GroupsExtension::getStringFromTypeCode(int typeCode)
366 {
367   int min = SBML_GROUPS_GROUP;
368   int max = SBML_GROUPS_MEMBER;
369 
370   if (typeCode < min || typeCode > max)
371   {
372     return '(Unknown SBML Groups Type)';
373   }
374 
375   return SBML_GROUPS_TYPECODE_STRINGS[typeCode - min];
376 }
377 @endcode
378  *
379  *
380  * @subsection ext-init 9. Implement an init() method
381  *
382  * Implement a <code>static void init()</code> method in the derived class.
383  * This method serves to encapsulate initialization code that creates an
384  * instance of the derived class and registration code that registers the
385  * instance with the SBMLExtensionRegistry class.
386  *
387  * For example, the <code>init()</code> method for the Groups package is
388  * implemented as follows:
389 @code{.cpp}
390 void GroupsExtension::init()
391 {
392   // 1. Check if the Groups package has already been registered.
393 
394   if ( SBMLExtensionRegistry::getInstance().isRegistered(getPackageName()) )
395   {
396     // do nothing;
397     return;
398   }
399 
400   // 2. Create an SBMLExtension derived object.
401 
402   GroupsExtension gext;
403 
404   // 3. Create SBasePluginCreator-derived objects. The derived classes
405   // can be instantiated by using the following template class:
406   //
407   //   template<class SBasePluginType> class SBasePluginCreator
408   //
409   // The constructor of the creator class takes two arguments:
410   //
411   // 1) SBaseExtensionPoint: extension point to which the plugin connects
412   // 2) std::vector<string>: a vector that contains a list of URI
413   // (package versions) supported by the plugin object.
414   //
415   // For example, two plugin objects are required as part of the Groups
416   // implementation: one plugged into SBMLDocument and one into Model.
417   // For the former, since the specification for the SBML Groups package
418   // mandates that the 'required' flag is always 'false', the existing
419   // SBMLDocumentPluginNotRequired class can be used as-is as part of
420   // the implementation.  For Model, since the lists of supported
421   // package versions (currently only SBML L3V1 Groups V1) are equal
422   // in the both plugin objects, the same vector can be handed to each
423   // constructor.
424 
425   std::vector<string> pkgURIs;
426   pkgURIs.push_back(getXmlnsL3V1V1());
427 
428   SBaseExtensionPoint docExtPoint('core', SBML_DOCUMENT);
429   SBaseExtensionPoint modelExtPoint('core', SBML_MODEL);
430 
431   SBasePluginCreator<GroupsSBMLDocumentPlugin, GroupsExtension> docPluginCreator(docExtPoint, pkgURIs);
432   SBasePluginCreator<GroupsModelPlugin, GroupsExtension> modelPluginCreator(modelExtPoint, pkgURIs);
433 
434   // 4. Add the above objects to the SBMLExtension-derived object.
435 
436   gext.addSBasePluginCreator(&docPluginCreator);
437   gext.addSBasePluginCreator(&modelPluginCreator);
438 
439   // 5. Register the SBMLExtension-derived object with the extension
440   // registry, SBMLExtensionRegistry.
441 
442   int result = SBMLExtensionRegistry::getInstance().addExtension(&gext);
443   if (result != LIBSBML_OPERATION_SUCCESS)
444   {
445     std::cerr << '[Error] GroupsExtension::init() failed.' << std::endl;
446   }
447 }
448 @endcode
449  *
450  *
451  * @subsection ext-extensionregister 10. Instantiate a SBMLExtensionRegister object
452  *
453  * Instantiate a global SBMLExtensionRegister object using the
454  * class derived from SBMLExtension (discussed above).  Here is an example for
455  * the Groups package extension, for the object <code>GroupsExtension</code>.
456  * This could is placed in the <code>GroupsExtension.cpp</code>:
457 @code{.cpp}
458 static SBMLExtensionRegister<GroupsExtension> groupsExtensionRegister;
459 @endcode
460  *
461  * The <code>init()</code> method on <code>GroupsExtension</code> is
462  * automatically invoked when the 'register' object is instantiated.  This
463  * results in initialization and registration of the package extension
464  * with libSBML.
465  *
466  *
467  * @else
468  *
469  * @section ext-basics Basic principles of SBML package extensions in libSBML
470  *
471  *
472  * SBML Level&nbsp;3's package structure permits modular extensions to the
473  * core SBML format.  In libSBML, support for SBML Level&nbsp;3 packages is
474  * provided through optional <em>package extensions</em> that can be plugged
475  * into libSBML at the time it is built/compiled.  Users of libSBML can thus
476  * choose which extensions are enabled in their software applications.
477  *
478  * LibSBML defines a number of classes that developers of package extensions
479  * can use to implement support for an SBML Level&nbsp;3 package.  These
480  * classes make it easier to extend libSBML objects with new attributes
481  * and/or subobjects as needed by a particular Level&nbsp;3 package.
482  * Three overall categories of classes make up libSBML's facilities for
483  * implementing package extensions.  There are (1) classes that serve as base
484  * classes meant to be subclassed, (2) template classes meant to be
485  * instantiated rather than subclassed, and (3) support classes that provide
486  * utility features. A given package implementation for libSBML will take
487  * the form of code using these and other libSBML classes, placed in a
488  * subdirectory of <code>src/sbml/packages/</code>.
489  *
490  * The basic libSBML distribution includes a number of package extensions
491  * implementing support for officially-endorsed SBML Level&nbsp;3 packages;
492  * among these are <em>Flux Balance Constraints</em> ('fbc'),
493  * <em>Hierarchical %Model Composition</em> ('comp'), <em>%Layout</em>
494  * ('layout'), and <em>Qualitative Models</em> ('qual').  They can serve as
495  * working examples for developers working to implement other packages.
496  *
497  * Extensions in libSBML can currently only be implemented in C++ or C;
498  * there is no mechanism to implement them first in languages such as
499  * Java or Python.  However, once implemented in C++ or C, language
500  * interfaces can be generated semi-automatically using the framework in
501  * place in libSBML.  (The approach is based on using <a target='_blank'
502  * href='http://www.swig.org'>SWIG</a> and facilities in libSBML's build
503  * system.)
504  *
505  *
506  * @endif
507  *
508  * @section sbmlextension-l2-special Special handling for SBML Level&nbsp;2
509  *
510  *
511  * Due to the historical background of the SBML %Layout package, libSBML
512  * implements special behavior for that package: it @em always creates a
513  * %Layout plugin object for any SBML Level&nbsp;2 document it reads in,
514  * regardless of whether that document actually uses %Layout constructs.  This
515  * is unlike the case for SBML Level&nbsp;3 documents that use %Layout; for
516  * them, libSBML will @em not create a plugin object unless the document
517  * actually declares the use of the %Layout package (via the usual Level&nbsp;3
518  * namespace declaration for Level&nbsp;3 packages).
519  *
520  * This has the following consequence.  If an application queries for the
521  * presence of %Layout in an SBML Level&nbsp;2 document by testing only for
522  * the existence of the plugin object, <strong>it will always get a positive
523  * result</strong>; in other words, the presence of a %Layout extension
524  * object is not an indication of whether a read-in Level&nbsp;2 document
525  * does or does not use SBML %Layout.  Instead, callers have to query
526  * explicitly for the existence of layout information.  An example of such a
527  * query is the following code:
528  * @if cpp
529 @code{.cpp}
530 // Assume 'm' below is a Model object.
531 LayoutModelPlugin* lmp = static_cast<LayoutModelPlugin*>(m->getPlugin('layout'));
532 if (lmp != null)
533 {
534   unsigned int numLayouts = lmp->getNumLayouts();
535   // If numLayouts is greater than zero, then the model uses Layout.
536 }
537 @endcode
538 @endif
539 @if python
540 @code{.py}
541 # Assume 'doc' below is an SBMLDocument object.
542 m = doc.getModel()
543 if m != None:
544     layoutPlugin = m.getPlugin('layout')
545     if layoutPlugin != None:
546         numLayouts = layoutPlugin.getNumLayouts()
547         # If numLayouts is greater than zero, then the model uses Layout.
548 @endcode
549 @endif
550 @if java
551 @code{.java}
552 // Assume 'doc' below is an SBMLDocument object.
553 Model m = doc.getModel();
554 LayoutModelPlugin lmp = (LayoutModelPlugin) m.getPlugin('layout');
555 if (lmp != null)
556 {
557   int numLayouts = lmp.getNumLayouts();
558   // If numLayouts is greater than zero, then the model uses Layout.
559 }
560 @endcode
561 @endif
562 @if csharp
563 @code{.cs}
564 // Assume 'doc' below is an SBMLDocument object.
565 Model m = doc.getModel();
566 LayoutModelPlugin lmp = (LayoutModelPlugin) m.getPlugin('layout');
567 if (lmp != null)
568 {
569   int numLayouts = lmp.getNumLayouts();
570   // If numLayouts is greater than zero, then the model uses Layout.
571 }
572 @endcode
573 @endif
574  *
575  * The special, always-available Level&nbsp;2 %Layout behavior was motivated
576  * by a desire to support legacy applications.  In SBML Level&nbsp;3, the
577  * %Layout package uses the normal SBML Level&nbsp;3 scheme of requiring
578  * declarations on the SBML document element.  This means that upon reading a
579  * model, libSBML knows right away whether it contains layout information.
580  * In SBML Level&nbsp;2, there is no top-level declaration because layout is
581  * stored as annotations in the body of the model.  Detecting the presence of
582  * layout information when reading a Level&nbsp;2 model requires parsing the
583  * annotations.  For efficiency reasons, libSBML normally does not parse
584  * annotations automatically when reading a model.  However, applications
585  * that predated the introduction of Level&nbsp;3 %Layout and the updated
586  * version of libSBML never had to do anything special to enable parsing
587  * layout; the facilities were always available for every Level&nbsp;2 model
588  * as long as libSBML was compiled with %Layout support.  To avoid burdening
589  * developers of legacy applications with the need to modify their software,
590  * libSBML provides backward compatibility by always preloading the %Layout
591  * package extension when reading Level&nbsp;2 models.  The same applies to
592  * the creation of Level&nbsp;2 models: with the plugin-oriented libSBML,
593  * applications normally would have to take deliberate steps to activate
594  * package code, instantiate objects, manage namespaces, and so on.  LibSBML
595  * again loads the %Layout package plugin automatically when creating a
596  * Level&nbsp;2 model, thereby making the APIs available to legacy
597  * applications without further work on their part.
598  *
599  * @if clike
600  * The mechanisms for triggering this Level&nbsp;2-specific behavior
601  * involves a set of virtual methods on the SBMLExtension class that must
602  * be implemented by individual package extensions.  These methods are
603  * SBMLExtension::addL2Namespaces(),
604  * SBMLExtension::removeL2Namespaces(), and
605  * SBMLExtension::enableL2NamespaceForDocument().
606  * @endif
607  *
608  *
609  */
610 
611 public class SBMLExtension : global::System.IDisposable {
612 	private HandleRef swigCPtr;
613 	protected bool swigCMemOwn;
614 
SBMLExtension(IntPtr cPtr, bool cMemoryOwn)615 	internal SBMLExtension(IntPtr cPtr, bool cMemoryOwn)
616 	{
617 		swigCMemOwn = cMemoryOwn;
618 		swigCPtr    = new HandleRef(this, cPtr);
619 	}
620 
getCPtr(SBMLExtension obj)621 	internal static HandleRef getCPtr(SBMLExtension obj)
622 	{
623 		return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
624 	}
625 
getCPtrAndDisown(SBMLExtension obj)626 	internal static HandleRef getCPtrAndDisown (SBMLExtension obj)
627 	{
628 		HandleRef ptr = new HandleRef(null, IntPtr.Zero);
629 
630 		if (obj != null)
631 		{
632 			ptr             = obj.swigCPtr;
633 			obj.swigCMemOwn = false;
634 		}
635 
636 		return ptr;
637 	}
638 
~SBMLExtension()639   ~SBMLExtension() {
640     Dispose(false);
641   }
642 
Dispose()643   public void Dispose() {
644     Dispose(true);
645     global::System.GC.SuppressFinalize(this);
646   }
647 
Dispose(bool disposing)648   protected virtual void Dispose(bool disposing) {
649     lock(this) {
650       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
651         if (swigCMemOwn) {
652           swigCMemOwn = false;
653           libsbmlPINVOKE.delete_SBMLExtension(swigCPtr);
654         }
655         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
656       }
657     }
658   }
659 
DowncastSBasePlugin(IntPtr cPtr, bool owner)660   public virtual SBasePlugin DowncastSBasePlugin(IntPtr cPtr, bool owner)
661   {
662     if (cPtr.Equals(IntPtr.Zero)) return null;
663 	return new SBasePlugin(cPtr, owner);
664   }
665 
DowncastSBase(IntPtr cPtr, bool owner)666   public virtual SBase DowncastSBase(IntPtr cPtr, bool owner)
667   {
668     if (cPtr.Equals(IntPtr.Zero)) return null;
669     return new SBase(cPtr, owner);
670   }
671 
672 
673 /**
674    * Returns the number of SBasePluginCreatorBase objects stored in this
675    * object.
676    *
677    * @return the total number of SBasePluginCreatorBase objects stored in
678    * this SBMLExtension-derived object.
679    */ public
getNumOfSBasePlugins()680  int getNumOfSBasePlugins() {
681     int ret = libsbmlPINVOKE.SBMLExtension_getNumOfSBasePlugins(swigCPtr);
682     return ret;
683   }
684 
685 
686 /**
687    * Returns the number of supported package namespace URIs.
688    *
689    * @return the number of supported package XML namespace URIs of this
690    * package extension.
691    */ public
getNumOfSupportedPackageURI()692  long getNumOfSupportedPackageURI() { return (long)libsbmlPINVOKE.SBMLExtension_getNumOfSupportedPackageURI(swigCPtr); }
693 
694 
695 /**
696    * Returns @c true if the given XML namespace URI is supported by this
697    * package extension.
698    *
699    * @return @c true if the given XML namespace URI (equivalent to a package
700    * version) is supported by this package extension, @c false otherwise.
701    */ public
isSupported(string uri)702  bool isSupported(string uri) {
703     bool ret = libsbmlPINVOKE.SBMLExtension_isSupported(swigCPtr, uri);
704     return ret;
705   }
706 
707 
708 /**
709    * Returns the nth XML namespace URI.
710    *
711    * @param n the index number of the namespace URI being sought.
712 
713    * @return a string representing the XML namespace URI understood to be
714    * supported by this package.  An empty string will be returned if there is
715    * no nth URI.
716    */ public
getSupportedPackageURI(long n)717  string getSupportedPackageURI(long n) {
718     string ret = libsbmlPINVOKE.SBMLExtension_getSupportedPackageURI(swigCPtr, n);
719     return ret;
720   }
721 
722 
723 /**
724    * Creates and returns a deep copy of this SBMLExtension object.
725    *
726    * @return a (deep) copy of this SBMLExtension object.
727    *
728    *
729  * @note
730  * This is a method that package extension implementations must override.
731  * See the libSBML documentation on extending libSBML to support SBML
732  * packages for more information on this topic.
733  *
734  *
735    */ public new
clone()736  SBMLExtension clone() {
737         SBMLExtension ret
738 	    = (SBMLExtension) libsbml.DowncastExtension(libsbmlPINVOKE.SBMLExtension_clone(swigCPtr), true);
739         return ret;
740 }
741 
742 
743 /**
744    * Returns the nickname of this package.
745    *
746    * This returns the short-form name of an SBML Level&nbsp;3 package
747    * implemented by a given SBMLExtension-derived class.  Examples of
748    * such names are 'layout', 'fbc', etc.
749    *
750    * @return a string, the nickname of SBML package.
751    *
752    *
753  * @note
754  * This is a method that package extension implementations must override.
755  * See the libSBML documentation on extending libSBML to support SBML
756  * packages for more information on this topic.
757  *
758  *
759    */ public new
getName()760  string getName() {
761     string ret = libsbmlPINVOKE.SBMLExtension_getName(swigCPtr);
762     return ret;
763   }
764 
765 
766 /**
767    * Returns the XML namespace URI for a given Level and Version.
768    *
769    * @param sbmlLevel the SBML Level.
770    * @param sbmlVersion the SBML Version.
771    * @param pkgVersion the version of the package.
772    *
773    * @return a string, the XML namespace URI for the package for the given
774    * SBML Level, SBML Version, and package version.
775    *
776    *
777  * @note
778  * This is a method that package extension implementations must override.
779  * See the libSBML documentation on extending libSBML to support SBML
780  * packages for more information on this topic.
781  *
782  *
783    */ public new
getURI(long sbmlLevel, long sbmlVersion, long pkgVersion)784  string getURI(long sbmlLevel, long sbmlVersion, long pkgVersion) {
785     string ret = libsbmlPINVOKE.SBMLExtension_getURI(swigCPtr, sbmlLevel, sbmlVersion, pkgVersion);
786     return ret;
787   }
788 
789 
790 /**
791    * Returns the SBML Level associated with the given XML namespace URI.
792    *
793    * @param uri the string of URI that represents a version of the package.
794    *
795    * @return the SBML Level associated with the given URI of this package.
796    *
797    *
798  * @note
799  * This is a method that package extension implementations must override.
800  * See the libSBML documentation on extending libSBML to support SBML
801  * packages for more information on this topic.
802  *
803  *
804    */ public new
getLevel(string uri)805  long getLevel(string uri) { return (long)libsbmlPINVOKE.SBMLExtension_getLevel(swigCPtr, uri); }
806 
807 
808 /**
809    * Returns the SBML Version associated with the given XML namespace URI.
810    *
811    * @param uri the string of URI that represents a version of the package.
812    *
813    * @return the SBML Version associated with the given URI of this package.
814    *
815    *
816  * @note
817  * This is a method that package extension implementations must override.
818  * See the libSBML documentation on extending libSBML to support SBML
819  * packages for more information on this topic.
820  *
821  *
822    */ public new
getVersion(string uri)823  long getVersion(string uri) { return (long)libsbmlPINVOKE.SBMLExtension_getVersion(swigCPtr, uri); }
824 
825 
826 /**
827    * Returns the package version associated with the given XML namespace URI.
828    *
829    * @param uri the string of URI that represents a version of this package.
830    *
831    * @return the package version associated with the given URI of this package.
832    *
833    *
834  * @note
835  * This is a method that package extension implementations must override.
836  * See the libSBML documentation on extending libSBML to support SBML
837  * packages for more information on this topic.
838  *
839  *
840    */ public new
getPackageVersion(string uri)841  long getPackageVersion(string uri) { return (long)libsbmlPINVOKE.SBMLExtension_getPackageVersion(swigCPtr, uri); }
842 
843 
844 /**
845    * Returns a string representation of a type code.
846    *
847    * This method takes a numerical type code @p typeCode for a component
848    * object implemented by this package extension, and returns a string
849    * representing that type code.
850    *
851    * @param typeCode the type code to turn into a string.
852    *
853    * @return the string representation of @p typeCode.
854    *
855    *
856  * @note
857  * This is a method that package extension implementations must override.
858  * See the libSBML documentation on extending libSBML to support SBML
859  * packages for more information on this topic.
860  *
861  *
862    */ public new
getStringFromTypeCode(int typeCode)863  string getStringFromTypeCode(int typeCode) {
864     string ret = libsbmlPINVOKE.SBMLExtension_getStringFromTypeCode(swigCPtr, typeCode);
865     return ret;
866   }
867 
868 
869 /**
870    * Returns a specialized SBMLNamespaces object corresponding to a given
871    * namespace URI.
872    *
873    * LibSBML package extensions each define a subclass of
874    * @if clike SBMLExtensionNamespaces @else SBMLNamespaces@endif.
875    * @if clike This object has the form
876    * @verbatim
877 SBMLExtensionNamespaces<class SBMLExtensionType>
878 @endverbatim
879    * For example, this kind of object for the Layout package is
880    * @verbatim
881 SBMLExtensionNamespaces<LayoutExtension>
882 @endverbatim
883 @endif
884    * The present method returns the appropriate object corresponding
885    * to the given XML namespace URI in argument @p uri.
886    *
887    * @param uri the namespace URI that represents one of versions of the
888    * package implemented in this extension.
889    *
890    * @return an @if clike SBMLExtensionNamespaces @else SBMLNamespaces @endif
891    * object, or @c null if the given @p uri is not defined in the
892    * corresponding package.
893    *
894    *
895  * @note
896  * This is a method that package extension implementations must override.
897  * See the libSBML documentation on extending libSBML to support SBML
898  * packages for more information on this topic.
899  *
900  *
901    */ public new
getSBMLExtensionNamespaces(string uri)902  SBMLNamespaces getSBMLExtensionNamespaces(string uri) {
903 	SBMLNamespaces ret
904 	    = (SBMLNamespaces) libsbml.DowncastSBMLNamespaces(libsbmlPINVOKE.SBMLExtension_getSBMLExtensionNamespaces(swigCPtr, uri), false);
905 	return ret;
906 }
907 
908 
909 /**
910    * Enable or disable this package.
911    *
912    * @param isEnabled flag indicating whether to enable (if @c true) or
913    * disable (@c false) this package extension.
914    *
915    * @return @c true if this call succeeded; @c false otherwise.
916    */ public
setEnabled(bool isEnabled)917  bool setEnabled(bool isEnabled) {
918     bool ret = libsbmlPINVOKE.SBMLExtension_setEnabled(swigCPtr, isEnabled);
919     return ret;
920   }
921 
922 
923 /**
924    * Returns @c true if this package is enabled.
925    *
926    * @return @c true if this package is enabled, @c false otherwise.
927    */ public
isEnabled()928  bool isEnabled() {
929     bool ret = libsbmlPINVOKE.SBMLExtension_isEnabled(swigCPtr);
930     return ret;
931   }
932 
933 
934 /**
935    * Removes the package's Level&nbsp;2 namespace(s).
936    *
937    * @ifnot clike @internal @endif
938    *
939    *
940  *
941  * This method is related to special facilities designed to support
942  * legacy behaviors surrounding SBML Level&nbsp;2 models.  Due to the
943  * historical background of the SBML %Layout package, libSBML implements
944  * special behavior for that package: it @em always creates a %Layout
945  * plugin object for any SBML Level&nbsp;2 document it reads in,
946  * regardless of whether that document actually uses %Layout constructs.
947  * Since Level&nbsp;2 does not use namespaces on the top level of the
948  * SBML document object, libSBML simply keys off the fact that the model
949  * is a Level&nbsp;2 model.  To allow the extensions for the %Layout and
950  * %Render (and possibly other) packages to support this behavior, the
951  * SBMLExtension class contains special methods to allow packages to
952  * hook themselves into the Level&nbsp;2 parsing apparatus when necessary.
953  *
954  * @if clike
955  * This virtual method should be overridden by all package extensions
956  * that want to serialize to an SBML Level&nbsp;2 annotation.  In
957  * Level&nbsp;2, the XML namespace declaration for the package is not
958  * placed on the top-level SBML document object but rather inside
959  * individual annotations.  addL2Namespaces() is invoked automatically
960  * for Level&nbsp;2 documents when an SBMLExtensionNamespace object is
961  * created; removeL2Namespaces() is automatically invoked by
962  * SBMLDocument to prevent the namespace(s) from being put on the
963  * top-level SBML Level&nbsp;2 element (because Level&nbsp;2 doesn't
964  * support namespaces there); and enableL2NamespaceForDocument() is
965  * called automatically when any SBML document (of any Level/Version) is
966  * read in.
967  * @endif
968    *
969    * @param xmlns an XMLNamespaces object that will be used for the annotation.
970    * Implementations should override this method with something that removes
971    * the package's namespace(s) from the set of namespaces in @p xmlns.  For
972    * instance, here is the code from the %Layout package extension:
973    * @code{.cpp}
974 for (int n = 0; n < xmlns->getNumNamespaces(); n++)
975 {
976   if (xmlns->getURI(n) == LayoutExtension::getXmlnsL2())
977     xmlns->remove(n);
978 }
979 @endcode
980    */ public new
removeL2Namespaces(XMLNamespaces xmlns)981  void removeL2Namespaces(XMLNamespaces xmlns) {
982     libsbmlPINVOKE.SBMLExtension_removeL2Namespaces(swigCPtr, XMLNamespaces.getCPtr(xmlns));
983   }
984 
985 
986 /**
987    * Adds the package's Level&nbsp;2 namespace(s).
988    *
989    * @ifnot clike @internal @endif
990    *
991    *
992  *
993  * This method is related to special facilities designed to support
994  * legacy behaviors surrounding SBML Level&nbsp;2 models.  Due to the
995  * historical background of the SBML %Layout package, libSBML implements
996  * special behavior for that package: it @em always creates a %Layout
997  * plugin object for any SBML Level&nbsp;2 document it reads in,
998  * regardless of whether that document actually uses %Layout constructs.
999  * Since Level&nbsp;2 does not use namespaces on the top level of the
1000  * SBML document object, libSBML simply keys off the fact that the model
1001  * is a Level&nbsp;2 model.  To allow the extensions for the %Layout and
1002  * %Render (and possibly other) packages to support this behavior, the
1003  * SBMLExtension class contains special methods to allow packages to
1004  * hook themselves into the Level&nbsp;2 parsing apparatus when necessary.
1005  *
1006  * @if clike
1007  * This virtual method should be overridden by all package extensions
1008  * that want to serialize to an SBML Level&nbsp;2 annotation.  In
1009  * Level&nbsp;2, the XML namespace declaration for the package is not
1010  * placed on the top-level SBML document object but rather inside
1011  * individual annotations.  addL2Namespaces() is invoked automatically
1012  * for Level&nbsp;2 documents when an SBMLExtensionNamespace object is
1013  * created; removeL2Namespaces() is automatically invoked by
1014  * SBMLDocument to prevent the namespace(s) from being put on the
1015  * top-level SBML Level&nbsp;2 element (because Level&nbsp;2 doesn't
1016  * support namespaces there); and enableL2NamespaceForDocument() is
1017  * called automatically when any SBML document (of any Level/Version) is
1018  * read in.
1019  * @endif
1020    *
1021    * @param xmlns an XMLNamespaces object that will be used for the annotation.
1022    * Implementation should override this method with something that adds
1023    * the package's namespace(s) to the set of namespaces in @p xmlns.  For
1024    * instance, here is the code from the %Layout package extension:
1025    * @code{.cpp}
1026 if (!xmlns->containsUri( LayoutExtension::getXmlnsL2()))
1027   xmlns->add(LayoutExtension::getXmlnsL2(), 'layout');
1028 @endcode
1029    */ public new
addL2Namespaces(XMLNamespaces xmlns)1030  void addL2Namespaces(XMLNamespaces xmlns) {
1031     libsbmlPINVOKE.SBMLExtension_addL2Namespaces(swigCPtr, XMLNamespaces.getCPtr(xmlns));
1032   }
1033 
1034 
1035 /**
1036    * Called to enable the package on the SBMLDocument object.
1037    *
1038    * @ifnot clike @internal @endif
1039    *
1040    *
1041  *
1042  * This method is related to special facilities designed to support
1043  * legacy behaviors surrounding SBML Level&nbsp;2 models.  Due to the
1044  * historical background of the SBML %Layout package, libSBML implements
1045  * special behavior for that package: it @em always creates a %Layout
1046  * plugin object for any SBML Level&nbsp;2 document it reads in,
1047  * regardless of whether that document actually uses %Layout constructs.
1048  * Since Level&nbsp;2 does not use namespaces on the top level of the
1049  * SBML document object, libSBML simply keys off the fact that the model
1050  * is a Level&nbsp;2 model.  To allow the extensions for the %Layout and
1051  * %Render (and possibly other) packages to support this behavior, the
1052  * SBMLExtension class contains special methods to allow packages to
1053  * hook themselves into the Level&nbsp;2 parsing apparatus when necessary.
1054  *
1055  * @if clike
1056  * This virtual method should be overridden by all package extensions
1057  * that want to serialize to an SBML Level&nbsp;2 annotation.  In
1058  * Level&nbsp;2, the XML namespace declaration for the package is not
1059  * placed on the top-level SBML document object but rather inside
1060  * individual annotations.  addL2Namespaces() is invoked automatically
1061  * for Level&nbsp;2 documents when an SBMLExtensionNamespace object is
1062  * created; removeL2Namespaces() is automatically invoked by
1063  * SBMLDocument to prevent the namespace(s) from being put on the
1064  * top-level SBML Level&nbsp;2 element (because Level&nbsp;2 doesn't
1065  * support namespaces there); and enableL2NamespaceForDocument() is
1066  * called automatically when any SBML document (of any Level/Version) is
1067  * read in.
1068  * @endif
1069    *
1070    * @param doc the SBMLDocument object for the model.
1071    * Implementations should override this method with something that
1072    * enables the package based on the package's namespace(s). For example,
1073    * here is the code from the %Layout package extension:
1074    * @code{.cpp}
1075 if (doc->getLevel() == 2)
1076   doc->enablePackage(LayoutExtension::getXmlnsL2(), 'layout', true);
1077 @endcode
1078    */ public new
enableL2NamespaceForDocument(SBMLDocument doc)1079  void enableL2NamespaceForDocument(SBMLDocument doc) {
1080     libsbmlPINVOKE.SBMLExtension_enableL2NamespaceForDocument(swigCPtr, SBMLDocument.getCPtr(doc));
1081   }
1082 
1083 
1084 /**
1085    * Indicates whether this extension is being used by the given SBMLDocument.
1086    *
1087    * The default implementation returns @c true.  This means that when a
1088    * document had this extension enabled, it will not be possible to convert
1089    * it to SBML Level&nbsp;2 as we cannot make sure that the extension can be
1090    * converted.
1091    *
1092    * @param doc the SBML document to test.
1093    *
1094    * @return a boolean indicating whether the extension is actually being
1095    * used by the document.
1096    */ public new
isInUse(SBMLDocument doc)1097  bool isInUse(SBMLDocument doc) {
1098     bool ret = libsbmlPINVOKE.SBMLExtension_isInUse(swigCPtr, SBMLDocument.getCPtr(doc));
1099     return ret;
1100   }
1101 
1102 
1103 /** */ /* libsbml-internal */ public new
hasMutiplePackageVersions()1104  bool hasMutiplePackageVersions() {
1105     bool ret = libsbmlPINVOKE.SBMLExtension_hasMutiplePackageVersions(swigCPtr);
1106     return ret;
1107   }
1108 
1109 
1110 /** */ /* libsbml-internal */ public new
getErrorTableIndex(long errorId)1111  long getErrorTableIndex(long errorId) { return (long)libsbmlPINVOKE.SBMLExtension_getErrorTableIndex(swigCPtr, errorId); }
1112 
1113 
1114 /** */ /* libsbml-internal */ public new
getErrorIdOffset()1115  long getErrorIdOffset() { return (long)libsbmlPINVOKE.SBMLExtension_getErrorIdOffset(swigCPtr); }
1116 
1117 
1118 /** */ /* libsbml-internal */ public
getSeverity(long index, long pkgVersion)1119  long getSeverity(long index, long pkgVersion) { return (long)libsbmlPINVOKE.SBMLExtension_getSeverity(swigCPtr, index, pkgVersion); }
1120 
1121 
1122 /** */ /* libsbml-internal */ public
getCategory(long index)1123  long getCategory(long index) { return (long)libsbmlPINVOKE.SBMLExtension_getCategory(swigCPtr, index); }
1124 
1125 
1126 /** */ /* libsbml-internal */ public
getMessage(long index, long pkgVersion, string details)1127  string getMessage(long index, long pkgVersion, string details) {
1128     string ret = libsbmlPINVOKE.SBMLExtension_getMessage(swigCPtr, index, pkgVersion, details);
1129     return ret;
1130   }
1131 
1132 
1133 /** */ /* libsbml-internal */ public
getShortMessage(long index)1134  string getShortMessage(long index) {
1135     string ret = libsbmlPINVOKE.SBMLExtension_getShortMessage(swigCPtr, index);
1136     return ret;
1137   }
1138 
1139 }
1140 
1141 }
1142