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 A list of Compartment objects.
20  *
21  *
22  *
23  * The various ListOf___ @if conly structures @else classes@endif in SBML
24  * are merely containers used for organizing the main components of an SBML
25  * model.  In libSBML's implementation, ListOf___
26  * @if conly data structures @else classes@endif are derived from the
27  * intermediate utility @if conly structure @else class@endif ListOf, which
28  * is not defined by the SBML specifications but serves as a useful
29  * programmatic construct.  ListOf is itself is in turn derived from SBase,
30  * which provides all of the various ListOf___
31  * @if conly data structures @else classes@endif with common features
32  * defined by the SBML specification, such as 'metaid' attributes and
33  * annotations.
34  *
35  * The relationship between the lists and the rest of an SBML model is
36  * illustrated by the following (for SBML Level&nbsp;2 Version&nbsp;4):
37  *
38  * @htmlinclude listof-illustration.html
39  *
40  * SBML Level&nbsp;3 Version&nbsp;1 has essentially the same structure as
41  * Level&nbsp;2 Version&nbsp;4, depicted above, but SBML Level&nbsp;3
42  * Version&nbsp;2 allows
43  * containers to contain zero or more of the relevant object, instead of
44  * requiring at least one.  As such, libsbml will write out an
45  * otherwise-empty ListOf___ element that has any optional attribute set
46  * (such as 'id' or 'metaid'), that has an optional child (such
47  * as a 'notes' or 'annotation'), or that has attributes or children set
48  * from any SBML Level&nbsp;3 package, whether or not the ListOf___ has
49  * any other children.
50  *
51  * Readers may wonder about the motivations for using the ListOf___
52  * containers in SBML.  A simpler approach in XML might be to place the
53  * components all directly at the top level of the model definition.  The
54  * choice made in SBML is to group them within XML elements named after
55  * %ListOf<em>Classname</em>, in part because it helps organize the
56  * components.  More importantly, the fact that the container classes are
57  * derived from SBase means that software tools can add information @em about
58  * the lists themselves into each list container's 'annotation'.
59  *
60  * @see ListOfFunctionDefinitions
61  * @see ListOfUnitDefinitions
62  * @see ListOfCompartmentTypes
63  * @see ListOfSpeciesTypes
64  * @see ListOfCompartments
65  * @see ListOfSpecies
66  * @see ListOfParameters
67  * @see ListOfInitialAssignments
68  * @see ListOfRules
69  * @see ListOfConstraints
70  * @see ListOfReactions
71  * @see ListOfEvents
72  *
73  * @if conly
74  * @note In the C API for libSBML, functions that in other language APIs
75  * would be inherited by the various ListOf___ structures not shown in the
76  * pages for the individual ListOf___'s.  Instead, the functions are defined
77  * on ListOf_t.  <strong>Please consult the documentation for ListOf_t for
78  * the many common functions available for manipulating ListOf___
79  * structures</strong>.  The documentation for the individual ListOf___
80  * structures (ListOfCompartments_t, ListOfReactions_t, etc.) does not reveal
81  * all of the functionality available. @endif
82  *
83  *
84  */
85 
86 public class ListOfCompartments : ListOf {
87 	private HandleRef swigCPtr;
88 
ListOfCompartments(IntPtr cPtr, bool cMemoryOwn)89 	internal ListOfCompartments(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.ListOfCompartments_SWIGUpcast(cPtr), cMemoryOwn)
90 	{
91 		//super(libsbmlPINVOKE.ListOfCompartmentsUpcast(cPtr), cMemoryOwn);
92 		swigCPtr = new HandleRef(this, cPtr);
93 	}
94 
getCPtr(ListOfCompartments obj)95 	internal static HandleRef getCPtr(ListOfCompartments obj)
96 	{
97 		return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
98 	}
99 
getCPtrAndDisown(ListOfCompartments obj)100 	internal static HandleRef getCPtrAndDisown (ListOfCompartments obj)
101 	{
102 		HandleRef ptr = new HandleRef(null, IntPtr.Zero);
103 
104 		if (obj != null)
105 		{
106 			ptr             = obj.swigCPtr;
107 			obj.swigCMemOwn = false;
108 		}
109 
110 		return ptr;
111 	}
112 
Dispose(bool disposing)113   protected override void Dispose(bool disposing) {
114     lock(this) {
115       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
116         if (swigCMemOwn) {
117           swigCMemOwn = false;
118           libsbmlPINVOKE.delete_ListOfCompartments(swigCPtr);
119         }
120         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
121       }
122       base.Dispose(disposing);
123     }
124   }
125 
126 
127 /**
128    * Creates a new ListOfCompartments object.
129    *
130    * The object is constructed such that it is valid for the given SBML
131    * Level and Version combination.
132    *
133    * @param level the SBML Level.
134    *
135    * @param version the Version within the SBML Level.
136    *
137    *
138  * @throws SBMLConstructorException
139  * Thrown if the given @p level and @p version combination are invalid
140  * or if this object is incompatible with the given level and version.
141  *
142  *
143    *
144    *
145  * @note Attempting to add an object to an SBMLDocument having a different
146  * combination of SBML Level, Version and XML namespaces than the object
147  * itself will result in an error at the time a caller attempts to make the
148  * addition.  A parent object must have compatible Level, Version and XML
149  * namespaces.  (Strictly speaking, a parent may also have more XML
150  * namespaces than a child, but the reverse is not permitted.)  The
151  * restriction is necessary to ensure that an SBML model has a consistent
152  * overall structure.  This requires callers to manage their objects
153  * carefully, but the benefit is increased flexibility in how models can be
154  * created by permitting callers to create objects bottom-up if desired.  In
155  * situations where objects are not yet attached to parents (e.g.,
156  * SBMLDocument), knowledge of the intented SBML Level and Version help
157  * libSBML determine such things as whether it is valid to assign a
158  * particular value to an attribute.
159  *
160  *
161    */ public
ListOfCompartments(long level, long version)162  ListOfCompartments(long level, long version) : this(libsbmlPINVOKE.new_ListOfCompartments__SWIG_0(level, version), true) {
163     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
164   }
165 
166 
167 /**
168    * Creates a new ListOfCompartments object.
169    *
170    * The object is constructed such that it is valid for the SBML Level and
171    * Version combination determined by the SBMLNamespaces object in @p
172    * sbmlns.
173    *
174    * @param sbmlns an SBMLNamespaces object that is used to determine the
175    * characteristics of the ListOfCompartments object to be created.
176    *
177    *
178  * @throws SBMLConstructorException
179  * Thrown if the given @p sbmlns is inconsistent or incompatible
180  * with this object.
181  *
182  *
183    *
184    *
185  * @note Attempting to add an object to an SBMLDocument having a different
186  * combination of SBML Level, Version and XML namespaces than the object
187  * itself will result in an error at the time a caller attempts to make the
188  * addition.  A parent object must have compatible Level, Version and XML
189  * namespaces.  (Strictly speaking, a parent may also have more XML
190  * namespaces than a child, but the reverse is not permitted.)  The
191  * restriction is necessary to ensure that an SBML model has a consistent
192  * overall structure.  This requires callers to manage their objects
193  * carefully, but the benefit is increased flexibility in how models can be
194  * created by permitting callers to create objects bottom-up if desired.  In
195  * situations where objects are not yet attached to parents (e.g.,
196  * SBMLDocument), knowledge of the intented SBML Level and Version help
197  * libSBML determine such things as whether it is valid to assign a
198  * particular value to an attribute.
199  *
200  *
201    */ public
ListOfCompartments(SBMLNamespaces sbmlns)202  ListOfCompartments(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_ListOfCompartments__SWIG_1(SBMLNamespaces.getCPtr(sbmlns)), true) {
203     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
204   }
205 
206 
207 /**
208    * Creates and returns a deep copy of this ListOfCompartments object.
209    *
210    * @return the (deep) copy of this ListOfCompartments object.
211    */ public new
clone()212  ListOfCompartments clone() {
213     global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfCompartments_clone(swigCPtr);
214     ListOfCompartments ret = (cPtr == global::System.IntPtr.Zero) ? null : new ListOfCompartments(cPtr, true);
215     return ret;
216   }
217 
218 
219 /**
220    * Returns the libSBML type code for the objects contained in this ListOf
221    * (i.e., Compartment objects, if the list is non-empty).
222    *
223    *
224  *
225  * LibSBML attaches an identifying code to every kind of SBML object.  These
226  * are integer constants known as <em>SBML type codes</em>.  The names of all
227  * the codes begin with the characters <code>SBML_</code>.
228  * @if clike The set of possible type codes for core elements is defined in
229  * the enumeration #SBMLTypeCode_t, and in addition, libSBML plug-ins for
230  * SBML Level&nbsp;3 packages define their own extra enumerations of type
231  * codes (e.g., #SBMLLayoutTypeCode_t for the Level&nbsp;3 Layout
232  * package).@endif@if java In the Java language interface for libSBML, the
233  * type codes are defined as static integer constants in the interface class
234  * {@link libsbmlConstants}.  @endif@if python In the Python language
235  * interface for libSBML, the type codes are defined as static integer
236  * constants in the interface class @link libsbml@endlink.@endif@if csharp In
237  * the C# language interface for libSBML, the type codes are defined as
238  * static integer constants in the interface class
239  * @link libsbmlcs.libsbml@endlink.@endif  Note that different Level&nbsp;3
240  * package plug-ins may use overlapping type codes; to identify the package
241  * to which a given object belongs, call the
242  * <code>@if conly SBase_getPackageName()
243  * @else SBase::getPackageName()
244  * @endif</code>
245  * method on the object.
246  *
247  * The exception to this is lists:  all SBML-style list elements have the type
248  * @link libsbml#SBML_LIST_OF SBML_LIST_OF@endlink, regardless of what package they
249  * are from.
250  *
251  *
252    *
253    * @return the SBML type code for the objects contained in this ListOf
254    * instance: @link libsbml#SBML_COMPARTMENT SBML_COMPARTMENT@endlink (default).
255    *
256    * @see getElementName()
257    * @see getPackageName()
258    */ public new
getItemTypeCode()259  int getItemTypeCode() {
260     int ret = libsbmlPINVOKE.ListOfCompartments_getItemTypeCode(swigCPtr);
261     return ret;
262   }
263 
264 
265 /**
266    * Returns the XML element name of this object.
267    *
268    * For ListOfCompartments, the XML element name is always
269    * @c 'listOfCompartments'.
270    *
271    * @return the name of this element.
272    */ public new
getElementName()273  string getElementName() {
274     string ret = libsbmlPINVOKE.ListOfCompartments_getElementName(swigCPtr);
275     return ret;
276   }
277 
278 
279 /**
280    * Get a Compartment object from the ListOfCompartments.
281    *
282    * @param n the index number of the Compartment object to get.
283    *
284    * @return the nth Compartment object in this ListOfCompartments.
285    * If the index @p n is invalid, @c null is returned.
286    *
287    * @see size()
288    */ public new
get(long n)289  Compartment get(long n) {
290     global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfCompartments_get__SWIG_0(swigCPtr, n);
291     Compartment ret = (cPtr == global::System.IntPtr.Zero) ? null : new Compartment(cPtr, false);
292     return ret;
293   }
294 
295 
296 /**
297    * Get a Compartment object from the ListOfCompartments
298    * based on its identifier.
299    *
300    * @param sid a string representing the identifier
301    * of the Compartment object to get.
302    *
303    * @return Compartment object in this ListOfCompartments
304    * with the given @p sid or @c null if no such
305    * Compartment object exists.
306    *
307    * @see get(unsigned int n)
308    * @see size()
309    */ public new
get(string sid)310  Compartment get(string sid) {
311     global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfCompartments_get__SWIG_2(swigCPtr, sid);
312     Compartment ret = (cPtr == global::System.IntPtr.Zero) ? null : new Compartment(cPtr, false);
313     return ret;
314   }
315 
316 
317 /**
318    * Removes the nth item from this ListOfCompartments items and returns a pointer to
319    * it.
320    *
321    * The caller owns the returned item and is responsible for deleting it.
322    *
323    * @param n the index of the item to remove.
324    *
325    * @see size()
326    */ public new
remove(long n)327  Compartment remove(long n) {
328     global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfCompartments_remove__SWIG_0(swigCPtr, n);
329     Compartment ret = (cPtr == global::System.IntPtr.Zero) ? null : new Compartment(cPtr, true);
330     return ret;
331   }
332 
333 
334 /**
335    * Removes item in this ListOfCompartments items with the given identifier.
336    *
337    * The caller owns the returned item and is responsible for deleting it.
338    * If none of the items in this list have the identifier @p sid, then
339    * @c null is returned.
340    *
341    * @param sid the identifier of the item to remove.
342    *
343    * @return the item removed.  As mentioned above, the caller owns the
344    * returned item.
345    */ public new
remove(string sid)346  Compartment remove(string sid) {
347     global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfCompartments_remove__SWIG_1(swigCPtr, sid);
348     Compartment ret = (cPtr == global::System.IntPtr.Zero) ? null : new Compartment(cPtr, true);
349     return ret;
350   }
351 
352 }
353 
354 }
355